python - Scrapy如何抓取tiktok中的视频链接
问题描述
我正在创建一个 tiktok 抓取项目,以获取任何用户 givin 的所有视频链接。
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
现在一切正常,但视频网址!我已经尝试了很多方法,并弄明白了。谁能指出我的方向?
谢谢
解决方案
推荐阅读
- c# - C# 让程序自行运行但能够在其上运行代码?
- c++ - 如何使用switch语句查找数字中数字的频率?
- ios - 如何使用核心图形绘制带有自定义图案/图像的线条/笔划?
- jupyter-notebook - Jupyter 笔记本服务器正在运行但未在浏览器中打开
- vue.js - 工作目录不是科尔多瓦项目
- jquery - 引导访问下拉菜单项元素(名称、href、文本)
- mongodb - 引用对象的猫鼬搜索属性
- excel - 建立子组并找到其局部最大值
- html - 当屏幕尺寸减小(宽度)时,如何使 flex 容器在行中显示 div?
- php - php数组访问foreach循环中的顶部对象文本