Created
October 26, 2018 01:38
-
-
Save kelby/633a1f14eb760b68b51893268132af18 to your computer and use it in GitHub Desktop.
Crawl google plus activities.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'google_plus' | |
api_key = "your api key" | |
user_id = "google plus user id" | |
GooglePlus.api_key = api_key | |
person = GooglePlus::Person.get(user_id, :key => api_key) | |
cursor = person.list_activities | |
page = 0 | |
200.times do |i| | |
x = cursor.next_page(maxResults: 100); | |
p "--- --- --- #{i} --- --- ---" | |
p cursor.instance_variable_get("@next_page_token") | |
# cursor.instance_variable_set("@next_page_token", "ADSJ_i05c-q_Xxy9RCX1qraP354gwRiGCMLkierGQlRm8nIizxbvYgKPDf3ArtsczK8NCwd5LqLojufjx2yzvc0ntXcGejNjXAWD3WZcqxH3ocDHhihGm7KjZ2ujcOK9hZJcnH7BUXXBxLeXlQ") | |
page = i | |
if x.last.nil? | |
p "=== === === === === ===" | |
break | |
else | |
p "#{x.size} -- #{x.last.published}" | |
end | |
sleep([2, 3, 4].sample) | |
end | |
p page |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment