diff --git a/docs/index.html b/docs/index.html
index e3a50e1..7fecf87 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -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));
}
})
})
diff --git a/docs/verified.png b/docs/verified.png
new file mode 100644
index 0000000..af8b2bb
Binary files /dev/null and b/docs/verified.png differ
diff --git a/scraper.py b/scraper.py
index c36bc95..42e617d 100644
--- a/scraper.py
+++ b/scraper.py
@@ -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"))
diff --git a/spider.py b/spider.py
index d33e0d7..9768ad1 100644
--- a/spider.py
+++ b/spider.py
@@ -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)