mirror of
https://github.com/netzbegruenung/social-spider.git
synced 2024-05-04 11:43:40 +02:00
add verification info to result, html page
This commit is contained in:
parent
f7456fd9b3
commit
82c2e43e2e
|
@ -83,26 +83,51 @@
|
||||||
var tbl_body = document.createElement("tbody");
|
var tbl_body = document.createElement("tbody");
|
||||||
$.each(data, function() {
|
$.each(data, function() {
|
||||||
var tbl_row = tbl_body.insertRow();
|
var tbl_row = tbl_body.insertRow();
|
||||||
|
var name;
|
||||||
|
var follower;
|
||||||
|
var isVerified;
|
||||||
$.each(this, function(idx , v) {
|
$.each(this, function(idx , v) {
|
||||||
var cell = tbl_row.insertCell();
|
if (idx < 5){
|
||||||
txt = v.toString();
|
var cell = tbl_row.insertCell();
|
||||||
if(idx == 5 && txt != "--"){
|
txt = v.toString();
|
||||||
var a = document.createElement('a');
|
|
||||||
a.appendChild(document.createTextNode(txt));
|
|
||||||
a.href = "https://www.facebook.com/" + txt;
|
|
||||||
cell.appendChild(a);
|
|
||||||
} else if (idx == 7 && txt != "--") {
|
|
||||||
var a = document.createElement('a');
|
|
||||||
a.appendChild(document.createTextNode(txt));
|
|
||||||
a.href = "https://www.twitter.com/" + txt;
|
|
||||||
cell.appendChild(a);
|
|
||||||
} else if (idx == 9 && txt != "--") {
|
|
||||||
var a = document.createElement('a');
|
|
||||||
a.appendChild(document.createTextNode(txt));
|
|
||||||
a.href = "https://www.instagram.com/" + txt;
|
|
||||||
cell.appendChild(a);
|
|
||||||
} else {
|
|
||||||
cell.appendChild(document.createTextNode(txt));
|
cell.appendChild(document.createTextNode(txt));
|
||||||
|
} else if (idx == 5 || idx == 8 || idx === 11) {
|
||||||
|
name = v.toString();
|
||||||
|
} else if (idx == 6 || idx == 9 || idx === 12) {
|
||||||
|
follower = v.toString();
|
||||||
|
} else if (idx == 7 || idx == 10 || idx === 13) {
|
||||||
|
var cell = tbl_row.insertCell();
|
||||||
|
var a = document.createElement('a');
|
||||||
|
isVerified = v;
|
||||||
|
if (isVerified)
|
||||||
|
{
|
||||||
|
verification = document.createElement("div");
|
||||||
|
icon = document.createElement("img")
|
||||||
|
icon.setAttribute("src", "verified.png")
|
||||||
|
icon.setAttribute("style", "height:19px;width:19px;float:left;margin-right:3px;");
|
||||||
|
verification.appendChild(icon)
|
||||||
|
text = document.createElement("div")
|
||||||
|
text.setAttribute("style", "float:left;text-decoration:underline;");
|
||||||
|
text.appendChild(document.createTextNode(name))
|
||||||
|
verification.appendChild(text);
|
||||||
|
a.appendChild(verification)
|
||||||
|
} else {
|
||||||
|
a.appendChild(document.createTextNode(name));
|
||||||
|
}
|
||||||
|
if (idx == 7 && name != "--") {
|
||||||
|
a.href = "https://www.facebook.com/" + name;
|
||||||
|
cell.appendChild(a);
|
||||||
|
} else if (idx == 10 && name != "--") {
|
||||||
|
a.href = "https://www.twitter.com/" + name;
|
||||||
|
cell.appendChild(a);
|
||||||
|
} else if (idx == 13 && name != "--") {
|
||||||
|
a.href = "https://www.instagram.com/" + name;
|
||||||
|
cell.appendChild(a);
|
||||||
|
} else {
|
||||||
|
cell.appendChild(document.createTextNode(name));
|
||||||
|
}
|
||||||
|
var cell2 = tbl_row.insertCell();
|
||||||
|
cell2.appendChild(document.createTextNode(follower));
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
BIN
docs/verified.png
Normal file
BIN
docs/verified.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 550 B |
|
@ -20,7 +20,7 @@ def scrapeInstagramData(username):
|
||||||
decoded = decode(result[1])
|
decoded = decode(result[1])
|
||||||
data = json.loads(decoded)
|
data = json.loads(decoded)
|
||||||
data["entry_data"]["ProfilePage"][0]["graphql"]["user"]["edge_owner_to_timeline_media"]["edges"] = "----"
|
data["entry_data"]["ProfilePage"][0]["graphql"]["user"]["edge_owner_to_timeline_media"]["edges"] = "----"
|
||||||
return data["entry_data"]["ProfilePage"][0]["graphql"]["user"]
|
return data["entry_data"]["ProfilePage"][0]["graphql"]["user"]["edge_followed_by"]["count"], data["entry_data"]["ProfilePage"][0]["graphql"]["user"]["is_verified"]
|
||||||
else:
|
else:
|
||||||
print("No data found for", username, file=sys.stderr)
|
print("No data found for", username, file=sys.stderr)
|
||||||
|
|
||||||
|
@ -55,4 +55,4 @@ def scrapeTwitterData(username):
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
print(scrapeFacebookData("B90DieGruenen"))
|
print(scrapeFacebookData("B90DieGruenen"))
|
||||||
print(scrapeTwitterData("Die_Gruenen"))
|
print(scrapeTwitterData("Die_Gruenen"))
|
||||||
print(scrapeInstagramData("die_gruenen")["edge_followed_by"]["count"])
|
print(scrapeInstagramData("die_gruenen"))
|
||||||
|
|
|
@ -146,10 +146,7 @@ def main():
|
||||||
elif url["type"] == "INSTAGRAM":
|
elif url["type"] == "INSTAGRAM":
|
||||||
instaName = getInstagramName(url["url"])
|
instaName = getInstagramName(url["url"])
|
||||||
try:
|
try:
|
||||||
instaData = scrapeInstagramData(instaName)
|
instaFollower, instaVerified = scrapeInstagramData(instaName)
|
||||||
if instaData:
|
|
||||||
instaFollower = instaData["edge_followed_by"]["count"]
|
|
||||||
instaVerified = instaData["is_verified"]
|
|
||||||
sleep(0.1)
|
sleep(0.1)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("INSTAGRAM ERROR for", url["url"], "--", instaName, file=sys.stderr)
|
print("INSTAGRAM ERROR for", url["url"], "--", instaName, file=sys.stderr)
|
||||||
|
@ -167,8 +164,10 @@ def main():
|
||||||
fbname = "--"
|
fbname = "--"
|
||||||
if fbLikes + twtFollower + instaFollower > 0:
|
if fbLikes + twtFollower + instaFollower > 0:
|
||||||
key = "//".join([typ, level, land, kreis, stadt])
|
key = "//".join([typ, level, land, kreis, stadt])
|
||||||
result.update({key: [typ, level, land, kreis, stadt, fbname, fbLikes, twtname, twtFollower, instaName, instaFollower]})
|
result.update({key: [typ, level, land, kreis, stadt, fbname, fbLikes, fbVerified, twtname, twtFollower, twtVerified, instaName, instaFollower, instaVerified]})
|
||||||
idx += 1
|
idx += 1
|
||||||
|
if idx == 50:
|
||||||
|
break
|
||||||
|
|
||||||
with open("docs/result.json", "w") as f:
|
with open("docs/result.json", "w") as f:
|
||||||
json.dump(result, f)
|
json.dump(result, f)
|
||||||
|
|
Loading…
Reference in a new issue