From 8364db68e8f8dd1f2712ba7ad3c3d1157c6357a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20S=C3=A1=20Couto?= Date: Mon, 18 Mar 2019 16:50:41 +0100 Subject: [PATCH] peer_instances.py is to scrape through API --- .DS_Store | Bin 6148 -> 6148 bytes answers_mastodonapi.py | 24 +++++ geckodriver.log | 237 +++++++++++++++++++++++++++++++++++++++++ peer_instances.py | 77 +++++++++++++ selenium_instances.py | 2 +- 5 files changed, 339 insertions(+), 1 deletion(-) create mode 100644 answers_mastodonapi.py create mode 100644 peer_instances.py diff --git a/.DS_Store b/.DS_Store index 9dad6945c41a959485d09c53011e6f50fd32d7e3..005784c178d009fc24d027a4e266b6d34bf42c2f 100644 GIT binary patch delta 57 zcmZoMXffDe$;4yEzU~?k#GM3G39RK(M D^C1&| delta 57 zcmZoMXffDe$;7BJ*@`I=NKRq01(T|izcWbySpv+i+|~>X3>yEzU~?k#GM3G39RK(M D?bs7q diff --git a/answers_mastodonapi.py b/answers_mastodonapi.py new file mode 100644 index 0000000..04dc6b1 --- /dev/null +++ b/answers_mastodonapi.py @@ -0,0 +1,24 @@ +from mastodon import Mastodon +from pprint import pprint +import time +import datetime + +mastodon = Mastodon( + access_token = '2e2c955d0ac906d8ac59863ea479ce061a88774e72e8b76bc2d764d28ba363ff', + api_base_url = 'https://todon.nl' +) + +descendants = mastodon.status_context(id=101767654564328802)["descendants"] + +for answer in descendants: + pprint(answer["id"]) + #geral = mastodon.status(answer["id"])) + avatar = mastodon.status(answer["id"])['account']['avatar'] + name = mastodon.status(answer["id"])['account']['display_name'] + bot = mastodon.status(answer["id"])['account']['bot'] + content = mastodon.status(answer["id"])['content'] + pprint("Avatar:" + "\n" + str(avatar) + "\n" + "\n") + pprint("Name:" + "\n" + str(name) + "\n" + "\n") + pprint("Bot:" + "\n" + str(bot) + "\n" + "\n") + pprint("Content:" + "\n" + str(content) + "\n" + "\n") + time.sleep(3) diff --git a/geckodriver.log b/geckodriver.log index 703c181..347242c 100755 --- a/geckodriver.log +++ b/geckodriver.log @@ -3438,3 +3438,240 @@ Exiting due to channel error. [GFX1-]: Receive IPC close with reason=AbnormalShutdown [Child 6810, Chrome_ChildThread] WARNING: pipe error: Broken pipe: file /builds/worker/workspace/build/src/ipc/chromium/src/chrome/common/ipc_channel_posix.cc, line 718 Exiting due to channel error. +1552840485430 mozrunner::runner INFO Running command: "/Applications/Firefox.app/Contents/MacOS/firefox-bin" "-marionette" "-foreground" "-no-remote" "-profile" "/var/folders/bc/txjl5mmd7cb1ngc8vvs687sc0000gn/T/rust_mozprofile.jfq1tkItjXPC" +1552840485907 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid host permission: resource://pdf.js/ +1552840485907 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid host permission: about:reader* +Can't find symbol 'GetGraphicsResetStatus'. +1552840487289 Marionette INFO Listening on port 62877 +1552840487373 Marionette WARN TLS certificate errors will be ignored for this session +JavaScript error: https://instances.social/list#lang=en&allowed=nudity_nocw,nudity_all,pornography_nocw,pornography_all,illegalContentLinks,spam,advertising,spoilers_nocw&prohibited=&users=, line 791: TypeError: getLanguage(...) is null +JavaScript error: https://instances.social/js/bootstrap.min.js, line 6: Error: Modal is transitioning +JavaScript error: https://instances.social/js/bootstrap.min.js, line 6: Error: Modal is transitioning +JavaScript error: https://instances.social/js/bootstrap.min.js, line 6: Error: Modal is transitioning +JavaScript error: https://instances.social/js/bootstrap.min.js, line 6: Error: Modal is transitioning +[GFX1-]: Receive IPC close with reason=AbnormalShutdown +[Child 7786, Chrome_ChildThread] WARNING: pipe error: Broken pipe: file /builds/worker/workspace/build/src/ipc/chromium/src/chrome/common/ipc_channel_posix.cc, line 718 +Exiting due to channel error. +Exiting due to channel error. +Exiting due to channel error. +1552840498945 mozrunner::runner INFO Running command: "/Applications/Firefox.app/Contents/MacOS/firefox-bin" "-marionette" "-foreground" "-no-remote" "-profile" "/var/folders/bc/txjl5mmd7cb1ngc8vvs687sc0000gn/T/rust_mozprofile.14xXkxydByCu" +1552840499347 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid host permission: resource://pdf.js/ +1552840499347 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid host permission: about:reader* +Can't find symbol 'GetGraphicsResetStatus'. +1552840500740 Marionette INFO Listening on port 62923 +1552840500787 Marionette WARN TLS certificate errors will be ignored for this session +JavaScript error: https://www.sosial.eu/core/search/js/search.js?v=35464648-0, line 146: ReferenceError: OCA is not defined +JavaScript error: https://www.sosial.eu/core/search/js/searchprovider.js?v=35464648-0, line 411: ReferenceError: OCA is not defined +JavaScript error: https://www.sosial.eu/core/js/files/fileinfo.js?v=35464648-0, line 147: ReferenceError: OC is not defined +JavaScript error: https://www.sosial.eu/core/js/files/client.js?v=35464648-0, line 940: ReferenceError: OC is not defined +JavaScript error: https://www.sosial.eu/core/js/contactsmenu.js?v=35464648-0, line 484: ReferenceError: OC is not defined +JavaScript error: https://www.sosial.eu/core/js/contactsmenu_templates.js?v=35464648-0, line 2: ReferenceError: OC is not defined +console.error: BroadcastService: + receivedBroadcastMessage: handler for + remote-settings/monitor_changes + threw error: + Message: Error: Polling for changes failed: NetworkError when attempting to fetch resource.. + Stack: + remoteSettingsFunction/remoteSettings.pollChanges@resource://services-settings/remote-settings.js:188:13 + +JavaScript error: https://instances.social/list#lang=en&allowed=nudity_nocw,nudity_all,pornography_nocw,pornography_all,illegalContentLinks,spam,advertising,spoilers_nocw&prohibited=&users=, line 791: TypeError: getLanguage(...) is null +JavaScript error: https://instances.social/js/bootstrap.min.js, line 6: Error: Modal is transitioning +JavaScript error: https://instances.social/js/bootstrap.min.js, line 6: Error: Modal is transitioning +1552840642654 mozrunner::runner INFO Running command: "/Applications/Firefox.app/Contents/MacOS/firefox-bin" "-marionette" "-foreground" "-no-remote" "-profile" "/var/folders/bc/txjl5mmd7cb1ngc8vvs687sc0000gn/T/rust_mozprofile.Dy7lxRKy2eUx" +1552840643057 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid host permission: resource://pdf.js/ +1552840643058 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid host permission: about:reader* +Can't find symbol 'GetGraphicsResetStatus'. +1552840644444 Marionette INFO Listening on port 63043 +1552840644486 Marionette WARN TLS certificate errors will be ignored for this session +console.error: BroadcastService: + receivedBroadcastMessage: handler for + remote-settings/monitor_changes + threw error: + Message: Error: Polling for changes failed: NetworkError when attempting to fetch resource.. + Stack: + remoteSettingsFunction/remoteSettings.pollChanges@resource://services-settings/remote-settings.js:188:13 + +JavaScript error: https://instances.social/list#lang=en&allowed=nudity_nocw,nudity_all,pornography_nocw,pornography_all,illegalContentLinks&prohibited=spam,advertising,spoilers_nocw&users=, line 791: TypeError: getLanguage(...) is null +JavaScript error: https://instances.social/js/bootstrap.min.js, line 6: Error: Modal is transitioning +JavaScript error: https://instances.social/js/bootstrap.min.js, line 6: Error: Modal is transitioning +JavaScript error: https://instances.social/js/bootstrap.min.js, line 6: Error: Modal is transitioning +JavaScript error: https://instances.social/js/bootstrap.min.js, line 6: Error: Modal is transitioning +JavaScript error: https://instances.social/js/bootstrap.min.js, line 6: Error: Modal is transitioning +JavaScript error: https://instances.social/js/bootstrap.min.js, line 6: Error: Modal is transitioning +JavaScript error: https://instances.social/js/bootstrap.min.js, line 6: Error: Modal is transitioning +JavaScript error: https://instances.social/js/bootstrap.min.js, line 6: Error: Modal is transitioning +JavaScript error: https://instances.social/js/bootstrap.min.js, line 6: Error: Modal is transitioning +JavaScript error: https://instances.social/js/bootstrap.min.js, line 6: Error: Modal is transitioning +JavaScript error: https://instances.social/js/bootstrap.min.js, line 6: Error: Modal is transitioning +JavaScript error: https://instances.social/js/bootstrap.min.js, line 6: Error: Modal is transitioning +JavaScript error: https://instances.social/js/bootstrap.min.js, line 6: Error: Modal is transitioning +1552841534172 mozrunner::runner INFO Running command: "/Applications/Firefox.app/Contents/MacOS/firefox-bin" "-marionette" "-foreground" "-no-remote" "-profile" "/var/folders/bc/txjl5mmd7cb1ngc8vvs687sc0000gn/T/rust_mozprofile.Ou72pwEQvb1i" +1552841534674 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid host permission: resource://pdf.js/ +1552841534674 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid host permission: about:reader* +Can't find symbol 'GetGraphicsResetStatus'. +1552841536060 Marionette INFO Listening on port 63467 +1552841536120 Marionette WARN TLS certificate errors will be ignored for this session +console.error: BroadcastService: + receivedBroadcastMessage: handler for + remote-settings/monitor_changes + threw error: + Message: Error: Polling for changes failed: NetworkError when attempting to fetch resource.. + Stack: + remoteSettingsFunction/remoteSettings.pollChanges@resource://services-settings/remote-settings.js:188:13 + +JavaScript error: https://instances.social/list#lang=en&allowed=nudity_nocw,nudity_all,pornography_nocw,pornography_all,illegalContentLinks&prohibited=spam,advertising,spoilers_nocw&users=, line 791: TypeError: getLanguage(...) is null +1552841647326 Marionette INFO Stopped listening on port 62923 +1552841649395 Marionette INFO Stopped listening on port 63043 +1552841651278 Marionette INFO Stopped listening on port 63467 +1552842054014 mozrunner::runner INFO Running command: "/Applications/Firefox.app/Contents/MacOS/firefox-bin" "-marionette" "-foreground" "-no-remote" "-profile" "/var/folders/bc/txjl5mmd7cb1ngc8vvs687sc0000gn/T/rust_mozprofile.oduLryWGNsh1" +1552842054434 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid host permission: resource://pdf.js/ +1552842054435 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid host permission: about:reader* +Can't find symbol 'GetGraphicsResetStatus'. +1552842055822 Marionette INFO Listening on port 63666 +1552842055834 Marionette WARN TLS certificate errors will be ignored for this session +console.error: BroadcastService: + receivedBroadcastMessage: handler for + remote-settings/monitor_changes + threw error: + Message: Error: Polling for changes failed: NetworkError when attempting to fetch resource.. + Stack: + remoteSettingsFunction/remoteSettings.pollChanges@resource://services-settings/remote-settings.js:188:13 + +[GFX1-]: Receive IPC close with reason=AbnormalShutdown +[GFX1-]: Receive IPC close with reason=AbnormalShutdown +Exiting due to channel error. +Exiting due to channel error. +[GFX1-]: Receive IPC close with reason=AbnormalShutdown +Exiting due to channel error. +[GFX1-]: Receive IPC close with reason=AbnormalShutdown +Exiting due to channel error. +1552842280008 mozrunner::runner INFO Running command: "/Applications/Firefox.app/Contents/MacOS/firefox-bin" "-marionette" "-foreground" "-no-remote" "-profile" "/var/folders/bc/txjl5mmd7cb1ngc8vvs687sc0000gn/T/rust_mozprofile.MvUgO7K2t2qJ" +1552842280407 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid host permission: resource://pdf.js/ +1552842280408 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid host permission: about:reader* +Can't find symbol 'GetGraphicsResetStatus'. +1552842281790 Marionette INFO Listening on port 63773 +1552842281846 Marionette WARN TLS certificate errors will be ignored for this session +console.error: BroadcastService: + receivedBroadcastMessage: handler for + remote-settings/monitor_changes + threw error: + Message: Error: Polling for changes failed: NetworkError when attempting to fetch resource.. + Stack: + remoteSettingsFunction/remoteSettings.pollChanges@resource://services-settings/remote-settings.js:188:13 + +1552842395662 mozrunner::runner INFO Running command: "/Applications/Firefox.app/Contents/MacOS/firefox-bin" "-marionette" "-foreground" "-no-remote" "-profile" "/var/folders/bc/txjl5mmd7cb1ngc8vvs687sc0000gn/T/rust_mozprofile.hAsT8B2h5oYU" +1552842396059 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid host permission: resource://pdf.js/ +1552842396060 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid host permission: about:reader* +Can't find symbol 'GetGraphicsResetStatus'. +1552842397450 Marionette INFO Listening on port 63835 +1552842397495 Marionette WARN TLS certificate errors will be ignored for this session +console.error: BroadcastService: + receivedBroadcastMessage: handler for + remote-settings/monitor_changes + threw error: + Message: Error: Polling for changes failed: NetworkError when attempting to fetch resource.. + Stack: + remoteSettingsFunction/remoteSettings.pollChanges@resource://services-settings/remote-settings.js:188:13 + +1552842488540 mozrunner::runner INFO Running command: "/Applications/Firefox.app/Contents/MacOS/firefox-bin" "-marionette" "-foreground" "-no-remote" "-profile" "/var/folders/bc/txjl5mmd7cb1ngc8vvs687sc0000gn/T/rust_mozprofile.dNFUAkQpzlop" +1552842488941 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid host permission: resource://pdf.js/ +1552842488941 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid host permission: about:reader* +Can't find symbol 'GetGraphicsResetStatus'. +1552842490328 Marionette INFO Listening on port 63908 +1552842490383 Marionette WARN TLS certificate errors will be ignored for this session +console.error: BroadcastService: + receivedBroadcastMessage: handler for + remote-settings/monitor_changes + threw error: + Message: Error: Polling for changes failed: NetworkError when attempting to fetch resource.. + Stack: + remoteSettingsFunction/remoteSettings.pollChanges@resource://services-settings/remote-settings.js:188:13 + +JavaScript error: https://instances.social/list#lang=en&allowed=nudity_nocw,nudity_all,pornography_nocw,pornography_all,illegalContentLinks&prohibited=spam,advertising,spoilers_nocw&users=, line 791: TypeError: getLanguage(...) is null +1552842656707 Marionette INFO Stopped listening on port 63773 +1552842657883 Marionette INFO Stopped listening on port 63835 +1552842660616 Marionette INFO Stopped listening on port 63908 +1552842673695 mozrunner::runner INFO Running command: "/Applications/Firefox.app/Contents/MacOS/firefox-bin" "-marionette" "-foreground" "-no-remote" "-profile" "/var/folders/bc/txjl5mmd7cb1ngc8vvs687sc0000gn/T/rust_mozprofile.GPdmIED42k8m" +1552842674089 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid host permission: resource://pdf.js/ +1552842674089 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid host permission: about:reader* +Can't find symbol 'GetGraphicsResetStatus'. +1552842675464 Marionette INFO Listening on port 64008 +1552842675529 Marionette WARN TLS certificate errors will be ignored for this session +[GFX1-]: Receive IPC close with reason=AbnormalShutdown +Exiting due to channel error. +[GFX1-]: Receive IPC close with reason=AbnormalShutdown +Exiting due to channel error. +[GFX1-]: Receive IPC close with reason=AbnormalShutdown +[Child 8212, Chrome_ChildThread] WARNING: pipe error: Broken pipe: file /builds/worker/workspace/build/src/ipc/chromium/src/chrome/common/ipc_channel_posix.cc, line 718 +Exiting due to channel error. +1552842729346 mozrunner::runner INFO Running command: "/Applications/Firefox.app/Contents/MacOS/firefox-bin" "-marionette" "-foreground" "-no-remote" "-profile" "/var/folders/bc/txjl5mmd7cb1ngc8vvs687sc0000gn/T/rust_mozprofile.wE1IgaZdeiom" +1552842729746 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid host permission: resource://pdf.js/ +1552842729746 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid host permission: about:reader* +Can't find symbol 'GetGraphicsResetStatus'. +1552842731122 Marionette INFO Listening on port 64061 +1552842731184 Marionette WARN TLS certificate errors will be ignored for this session +console.error: BroadcastService: + receivedBroadcastMessage: handler for + remote-settings/monitor_changes + threw error: + Message: Error: Polling for changes failed: NetworkError when attempting to fetch resource.. + Stack: + remoteSettingsFunction/remoteSettings.pollChanges@resource://services-settings/remote-settings.js:188:13 + +JavaScript error: https://instances.social/list#lang=en&allowed=nudity_nocw,nudity_all,pornography_nocw,pornography_all,illegalContentLinks&prohibited=spam,advertising,spoilers_nocw&users=, line 791: TypeError: getLanguage(...) is null +1552842829213 Marionette INFO Stopped listening on port 64061 +1552857870142 mozrunner::runner INFO Running command: "/Applications/Firefox.app/Contents/MacOS/firefox-bin" "-marionette" "-foreground" "-no-remote" "-profile" "/var/folders/bc/txjl5mmd7cb1ngc8vvs687sc0000gn/T/rust_mozprofile.Qwz0VSMYlLQj" +1552857870673 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid host permission: resource://pdf.js/ +1552857870673 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid host permission: about:reader* +Can't find symbol 'GetGraphicsResetStatus'. +1552857872144 Marionette INFO Listening on port 50533 +1552857872180 Marionette WARN TLS certificate errors will be ignored for this session +console.error: BroadcastService: + receivedBroadcastMessage: handler for + remote-settings/monitor_changes + threw error: + Message: Error: Polling for changes failed: NetworkError when attempting to fetch resource.. + Stack: + remoteSettingsFunction/remoteSettings.pollChanges@resource://services-settings/remote-settings.js:188:13 + +[GFX1-]: Receive IPC close with reason=AbnormalShutdown +Exiting due to channel error. +[GFX1-]: Receive IPC close with reason=AbnormalShutdown +Exiting due to channel error. +[GFX1-]: Receive IPC close with reason=AbnormalShutdown +[GFX1-]: Receive IPC close with reason=AbnormalShutdown +Exiting due to channel error. +Exiting due to channel error. +1552858663569 mozrunner::runner INFO Running command: "/Applications/Firefox.app/Contents/MacOS/firefox-bin" "-marionette" "-foreground" "-no-remote" "-profile" "/var/folders/bc/txjl5mmd7cb1ngc8vvs687sc0000gn/T/rust_mozprofile.4wAJVQoQc92Z" +1552858664113 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid host permission: resource://pdf.js/ +1552858664113 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid host permission: about:reader* +Can't find symbol 'GetGraphicsResetStatus'. +1552858665521 Marionette INFO Listening on port 51036 +1552858665625 Marionette WARN TLS certificate errors will be ignored for this session +1552858670028 Marionette INFO Stopped listening on port 51036 +1552907452595 mozrunner::runner INFO Running command: "/Applications/Firefox.app/Contents/MacOS/firefox-bin" "-marionette" "-foreground" "-no-remote" "-profile" "/var/folders/bc/txjl5mmd7cb1ngc8vvs687sc0000gn/T/rust_mozprofile.O9FJZ85u2XDe" +1552907453088 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid host permission: resource://pdf.js/ +1552907453088 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid host permission: about:reader* +Can't find symbol 'GetGraphicsResetStatus'. +1552907454487 Marionette INFO Listening on port 56839 +1552907454542 Marionette WARN TLS certificate errors will be ignored for this session +Exiting due to channel error. +[GFX1-]: Receive IPC close with reason=AbnormalShutdown +Exiting due to channel error. +Exiting due to channel error. +1552916755994 mozrunner::runner INFO Running command: "/Applications/Firefox.app/Contents/MacOS/firefox-bin" "-marionette" "-foreground" "-no-remote" "-profile" "/var/folders/bc/txjl5mmd7cb1ngc8vvs687sc0000gn/T/rust_mozprofile.u4GMQXJ1hi7M" +1552916756519 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid host permission: resource://pdf.js/ +1552916756519 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid host permission: about:reader* +Can't find symbol 'GetGraphicsResetStatus'. +1552916758034 Marionette INFO Listening on port 60513 +1552916758052 Marionette WARN TLS certificate errors will be ignored for this session +Can't find symbol 'GetGraphicsResetStatus'. +JavaScript warning: https://nuage.acostey.fr/client/en_US/9.3bf50d86768a19b43a7e.js, line 0: Successfully compiled asm.js code (total compilation time 1ms; not stored in cache (too small to benefit)) +console.error: BroadcastService: + receivedBroadcastMessage: handler for + remote-settings/monitor_changes + threw error: + Message: Error: Polling for changes failed: NetworkError when attempting to fetch resource.. + Stack: + remoteSettingsFunction/remoteSettings.pollChanges@resource://services-settings/remote-settings.js:188:13 + diff --git a/peer_instances.py b/peer_instances.py new file mode 100644 index 0000000..97abb93 --- /dev/null +++ b/peer_instances.py @@ -0,0 +1,77 @@ +# import libraries +from selenium import webdriver +from selenium.webdriver.common.keys import Keys +import os +import time +import datetime +from pprint import pprint +import requests +import multiprocessing +from mastodon import Mastodon +from pprint import pprint + +mastodon = Mastodon( + access_token = '9cebc1c5ff071137342c761224d2ce1ce3740b0243c151dd4218353f65c65ca1', + api_base_url = 'https://post.lurk.org' +) + +peers = mastodon.instance_peers() + +today = datetime.date.today() +text_file = open("results.txt", "a+") +text_file.write("Data collected on : "+str(today)+"\n"+"\n") + + +for n, peer in enumerate(peers): + if n < 9: + time.sleep(0.5) + # get the url from the terminal + # url ("Enter instance.social url (include https:// ): ") + url = "https://"+(str(peer)) + print(peer) + + # Tell Selenium to open a new Firefox session + # and specify the path to the driver + driver = webdriver.Firefox(executable_path=os.path.dirname(os.path.realpath(__file__)) + '/geckodriver') + + # Implicit wait tells Selenium how long it should wait before it throws an exception + driver.implicitly_wait(10) + driver.get(url) + time.sleep(3) + + print ('Instance:', "\n", peer) + text_file.write("Instance: "+"\n"+(peer)+"\n") + + try: + description = driver.find_element_by_xpath('/html/body/div[1]/div/div/div[3]/div[2]/div') + print ('Description:') + print(description.text) + text_file.write("Description: "+"\n"+description.text+"\n"+"\n") + time.sleep(1) + + try: + # get the image source + img = driver.find_element_by_css_selector('.landing-page__hero > img:nth-child(1)') + src = img.get_attribute('src') + # download the image + Picture_request = requests.get(src) + if Picture_request.status_code == 200: + with open("{}.jpg".format(peer), 'wb') as f: + f.write(Picture_request.content) + print("Printed Image") + + except: + print("Impossible to print image") + + except: + print("Impossible to check instance") + + time.sleep(0.5) + + # close new tab + driver.close() + print("Closing Window") + +text_file.close() +# close the browser +driver.close() diff --git a/selenium_instances.py b/selenium_instances.py index 050eaa3..aec008e 100644 --- a/selenium_instances.py +++ b/selenium_instances.py @@ -14,7 +14,7 @@ text_file.write("Data collected on : "+str(today)+"\n"+"\n") # get the url from the terminal # url = input("Enter instance.social url (include https:// ): ") -url = "https://instances.social/list#lang=en&allowed=&prohibited=nudity_nocw,nudity_all,pornography_nocw,pornography_all,illegalContentLinks,spam,advertising,spoilers_nocw&users=" +url = "https://instances.social/list#lang=en&allowed=nudity_nocw,nudity_all,pornography_nocw,pornography_all,illegalContentLinks&prohibited=spam,advertising,spoilers_nocw&users=" # Tell Selenium to open a new Firefox session # and specify the path to the driver