我正在创建一个 tiktok 抓取项目,以获取任何用户提供的所有视频链接。
class Someclass:
def parse(self, response):
items = TiktokscrapyItem()
full_name = response.css('h1.share-sub-title::text').extract()
User_Name = response.css('.share-title::text').extract()
verified_username = response.css('.verified::text').extract()
Following = response.css('.number:nth-child(1) strong::text').extract()
Followers = response.css('.number:nth-child(2) strong::text').extract()
Likes = response.css('.number~ .number+ .number strong::text').extract()
Bio = response.css('.mt10::text').extract()
profile_img = response.css('.user-page-header img::attr(src)').extract()
video_url = response.css('a[href*=tiktok.com]::attr(href)').extract()
items['full_name'] = full_name
items['User_Name'] = User_Name
items['verified_username'] = verified_username
items['Following'] = Following
items['Followers'] = Followers
items['Likes'] = Likes
items['Bio'] = Bio
items['profile_img'] = profile_img
items['video_url'] = video_url
yield items
现在一切正常,但视频网址!我尝试了很多方法并且cnt弄明白了。谁能给我指点方向?
谢谢