class TikToker::ProfileIterator
- TikToker::ProfileIterator
- Reference
- Object
Overview
A ProfileIterator allows iterating a TikTok::UserProfile by page.
For example:
iterator = TikToker::ProfileIterator.new("SecUID", "0")
iterator.next # => Page 1
iterator.next # => Page 2
iterator.next # => Iterator::StopMost of the time, what you really want is to iterate through the posts
without having to worry about pagination. See #each_post.
iterator = TikToker::ProfileIterator.new("SecUID", "0")
iterator.each_post do |post|
  post # => TikTok::Post
endIncluded Modules
- Iterator(TikToker::TikTok::Post)
Defined in:
tiktoker/iterators/profile_iterator.crConstructors
Instance Method Summary
- 
        #cursor : String
        
          Returns the current cursor position of the iterator. 
- 
        #each_post(&)
        
          Yields successive posts from the user profile. 
- 
        #has_more?
        
          Returns trueuntil the iterator receives a TikTok response indicating that the user profile has been fully iterated over.
- 
        #next
        
          Fetches the next page from the user profile, and updates the cursor position. 
- 
        #sec_uid : SecUID
        
          Returns the secUid of the owner of the profile being iterated through. 
Constructor Detail
Instance Method Detail
Yields successive posts from the user profile. It iterates through all pages from the current cursor to the oldest post.
iterator = TikToker::ProfileIterator.new(SEC_UID, "0")
iterator.each_post do |post|
  post # => TikTok::Post
endReturns true until the iterator receives a TikTok response indicating
that the user profile has been fully iterated over.
iterator = TikToker::ProfileIterator.new(SEC_UID, "0")
iterator.has_more? # => true
iterator.next      # => TikTok::PostCollection
iterator.has_more? # => false
iterator.next      # => Iterator::StopFetches the next page from the user profile, and updates the cursor
position. Raises TikToker::NoPostsError if TikTok API returns no posts
for the given sec_uid.
iterator = TikToker::ProfileIterator.new(SEC_UID, "0")
iterator.cursor # => "0"
iterator.next   # => Array(TikTok::Post)
iterator.cursor # => "1614377227000"Returns the secUid of the owner of the profile being iterated through.