A zero-dependency Ruby client for the Scrape Creators API.
Add this line to your application's Gemfile:
gem 'scrape_creators', '0.6.0'And then execute:
$ bundle installConfigure your API key in an initializer (e.g., config/initializers/scrape_creators.rb):
ScrapeCreators.configure do |config|
config.api_key = ENV['SCRAPE_CREATORS_API_KEY']
endInitialize a client:
scraper = ScrapeCreators::Client.newposts = scraper.posts("zuck")posts = scraper.posts("zuck", source: 'tiktok')posts = scraper.posts("zuck", source: 'youtube')All three platforms support cursor-based pagination. By default posts returns the first page only. Pass pages: to fetch more (e.g. 5 for the first five pages of a creator's feed):
posts = scraper.posts("zuck", pages: 5) # Instagram
posts = scraper.posts("zuck", source: 'tiktok', pages: 5) # TikTok
posts = scraper.posts("zuck", source: 'youtube', pages: 5) # YouTube ShortsIf you need finer control, posts_page returns { items:, cursor:, has_more: } so you can page through the full timeline yourself:
page = scraper.posts_page("zuck", source: 'tiktok')
loop do
page[:items].each { |item| puts item['desc'] }
break unless page[:has_more] && page[:cursor]
page = scraper.posts_page("zuck", source: 'tiktok', cursor: page[:cursor])
endinfo = scraper.post("https://www.instagram.com/p/DKSMEpKRd6h/", download_media: true)comments = scraper.comments("https://www.instagram.com/p/DKSMEpKRd6h/")The gem is available as open source under the terms of the MIT License.
client.search_users("sean walker", source: "instagram")
client.search_users("sean walker", source: "tiktok")
client.search_users("sean walker", source: "youtube")
# => [{ handle: "seanwalker", name: "Sean Walker", avatar_url: "https://..." }]Returns one page of accounts, deduplicated by handle. YouTube searches channels,
whose handles can be passed to posts_page to fetch Shorts. Results without a
usable handle are omitted. Blank queries and unsupported sources raise
ArgumentError; unsuccessful API responses raise ScrapeCreators::APIError.