add verification info to result, html page

This commit is contained in:
Lukas Mehl 2019-10-19 15:26:42 +02:00
parent f7456fd9b3
commit 82c2e43e2e
4 changed files with 49 additions and 25 deletions

View File

@ -83,26 +83,51 @@
var tbl_body = document.createElement("tbody");
$.each(data, function() {
var tbl_row = tbl_body.insertRow();
var name;
var follower;
var isVerified;
$.each(this, function(idx , v) {
var cell = tbl_row.insertCell();
txt = v.toString();
if(idx == 5 && txt != "--"){
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 {
if (idx < 5){
var cell = tbl_row.insertCell();
txt = v.toString();
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

Binary file not shown.

After

Width:  |  Height:  |  Size: 550 B

View File

@ -20,7 +20,7 @@ def scrapeInstagramData(username):
decoded = decode(result[1])
data = json.loads(decoded)
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:
print("No data found for", username, file=sys.stderr)
@ -55,4 +55,4 @@ def scrapeTwitterData(username):
if __name__ == '__main__':
print(scrapeFacebookData("B90DieGruenen"))
print(scrapeTwitterData("Die_Gruenen"))
print(scrapeInstagramData("die_gruenen")["edge_followed_by"]["count"])
print(scrapeInstagramData("die_gruenen"))

View File

@ -146,10 +146,7 @@ def main():
elif url["type"] == "INSTAGRAM":
instaName = getInstagramName(url["url"])
try:
instaData = scrapeInstagramData(instaName)
if instaData:
instaFollower = instaData["edge_followed_by"]["count"]
instaVerified = instaData["is_verified"]
instaFollower, instaVerified = scrapeInstagramData(instaName)
sleep(0.1)
except Exception as e:
print("INSTAGRAM ERROR for", url["url"], "--", instaName, file=sys.stderr)
@ -167,8 +164,10 @@ def main():
fbname = "--"
if fbLikes + twtFollower + instaFollower > 0:
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
if idx == 50:
break
with open("docs/result.json", "w") as f:
json.dump(result, f)