哔哩哔哩爬取器:以个人为中心

Overview

Open Bilibili Crawer

哔哩哔哩是一个信息非常丰富的社交平台,我们基于此构造社交网络。在该网络中,节点包括用户(up主),以及视频、专栏等创作产物;关系包括:用户之间,包括关注关系(following/follower),回复关系(评论区),转发关系(对视频or动态转发);用户对创作物,包括评论关系(包括评论文本),发弹幕关系(包括弹幕文本),点赞、投币关系等。创作物之间的关系也可以人为构建,比如所属同一类别分区,拥有50%以上的相同tag等。

综上,哔哩哔哩网络是一个信息丰富的异质网络。

我们尝试以一个人为中心,去爬取他的个人信息与创作物信息。通过对指定的一群人进行信息的爬取,我们就可以得到一张信息丰富的异质网络。所以,OBC(Open Bilibili Crawer)的输入是一个用户,或一组用户的id(mid)。

OBC目前封装了三类爬虫:==关系爬虫、个人信息爬虫和视频爬虫==。关系爬虫负责通过默认的following关系爬取用户之间的关系,构建基础用户网络;个人信息爬虫负责抓取用户尽量多的有价值信息,提供用户节点属性;视频爬虫负责爬取视频相关的文本信息与统计类信息,可以进一步丰富用户节点属性,也可以构建异质视频节点。

OBC构建的异质网络

1. 关系爬虫

由于B站限制,对自己以外的用户最多只能浏览100个关注者/粉丝,所以关系爬虫对每个用户最多爬取100个他的关注者。对于大V来说,关注者数量通常远小于粉丝的数量,所以这种采样方法可以尽量减少网络结构的偏差。该爬虫返回三元组的列表,字段包括:

字段名 含义 备注
from_nd 中心用户mid
to_nd 中心用户关注的用户mid
rel_type 默认为“following”

这样的含义是:from_nd关注了to_nd。

2. 个人信息爬虫

个人信息分散在多个接口中,我们爬取的个人信息字段包括:

字段名 含义 备注
nfollowing 关注者数量
nfollower 粉丝数量
uname 用户名
sex 性别 男 女 保密
sign 个人简介
level b站等级 0-6的整数
official 官方头衔 以、分隔的字符串,分隔后每个元素都是一个头衔
birthday 生日 MM-DD格式,如01-01
school 学校
profession 职业
video_view 视频总播放量
article_view 专栏总阅读量
nlike 总点赞数

还有视频投稿数等一些指标没有集成进来。不过这些应该足够作为节点属性了。

3. 视频爬虫

该爬虫首先找到个人最近投稿的最多50条视频,然后对每条视频抓取一些文本信息和统计量。视频条数可以扩充。

文本信息包括视频所属类别(typeid)和视频的标签(tag 、tid)。爬虫还会存储所有遇见过的标签的信息,包括标签的题目、tid、关注该标签的人数、使用过该标签的人数等。此外,只需要建立typeid和标签的关联就可以大致判断出typeid代表的分区类型。统计量包括视频播放量等一系列数值。此外,接口还提供了视频时长、视频发布时间等更多的指标,这些并没有集成进来。

目前,每个人的视频信息包括:

    "mid" : 359797,      //mid
    "video_type" : {     //对视频所属种类的统计,视频种类以typeid代表
        "138" : 44,
        "21" : 4,
        "240" : 1,
        "28" : 1
    },
    "video_tag" : {     //对视频的标签出现频次按照降序排列,最多存50个,标签以标签id(tid)代表,可以在全局存标签信息的数据中查找到对应的标签名
        "1711163" : 38,
        "1833" : 17,
        "7662089" : 11,
        "6497596" : 10,
        "13926" : 9,
        ...
        "19327" : 1,
        "34356" : 1
    },
    "video_stat" : [   // 列表,每个元素都是视频的一些统计信息,包括8个指标
        {
            "aid" : 848235319,
            "bvid" : "BV1ZL4y1872w",
            "view" : 84679,
            "danmaku" : 107,  // 弹幕数
            "reply" : 273,
            "favorite" : 299,
            "coin" : 302,
            "share" : 309,
            "like" : 5082,
            "his_rank" : 0  // 0以外越小越好
        }, 
        {
            "aid" : 848011693,
            "bvid" : "BV1aL4y1a77s",
            "view" : 3128993,
            "danmaku" : 1767,
            "reply" : 4511,
            "favorite" : 33329,
            "coin" : 21221,
            "share" : 46047,
            "like" : 177489,
            "his_rank" : 34
        }, 
        ...
        ]

可以这样利用视频信息:

  1. 对每个人取topK个标签,把标签编码为向量后作为用户节点的属性之一
  2. 取每个人的视频所属类别最多的那个类别(typeid)作为用户节点的标签,看成K类别的多分类问题
  3. 视频的统计量,每个指标取sum/mean/max作为用户节点属性的一个维度

每个标签的信息如下:

{
	"tid" : 1767558,
    "tag_name" : "VLOG日常",
    "subscribe" : 5225,  // 关注数
    "use" : 1447949,     // 使用数
    "feature" : 0
}

4. Future Work

OBC建立在已圈定一批用户的基础上,对这批用户构造信息丰富的网络结构。如何圈定用户不在OBC职能之内。

未来工作包括:

  1. 构造异质节点和边:目前虽然可以构造视频节点,但用户和视频之间只有”发布视频“一种关系,还没有办法增加其他”用户--视频“关系如点赞、评论等。
  2. 本网络能服务于哪些下游任务?需要我们和看到此项目的各位一同思考。
  3. 增强OBC性能:添加代理、多线程等。
Owner
Boshen Shi
Devoted to my true belief
Boshen Shi
An application that on a given url, crowls a web page and gets all words, sorts and counts them.

Web-Scrapping-1 An application that on a given url, crowls a web page and gets all words, sorts and counts them. Installation Using the package manage

adriano atambo 1 Jan 16, 2022
This Spider/Bot is developed using Python and based on Scrapy Framework to Fetch some items information from Amazon

- Hello, This Project Contains Amazon Web-bot. - I've developed this bot for fething some items information on Amazon. - Scrapy Framework in Python is

Khaled Tofailieh 4 Feb 13, 2022
Dude is a very simple framework for writing web scrapers using Python decorators

Dude is a very simple framework for writing web scrapers using Python decorators. The design, inspired by Flask, was to easily build a web scraper in just a few lines of code. Dude has an easy-to-lea

Ronie Martinez 326 Dec 15, 2022
This app will let you continuously scrape certain parts of LeasePlan and extract data of cars becoming available for lease.

LeasePlan - Scraper This app will let you continuously scrape certain parts of LeasePlan and extract data of cars becoming available for lease. It has

Rodney 4 Nov 18, 2022
Visual scraping for Scrapy

Portia Portia is a tool that allows you to visually scrape websites without any programming knowledge required. With Portia you can annotate a web pag

Scrapinghub 8.7k Jan 05, 2023
Free-Game-Scraper is a useful script that allows you to track down free games and DLCs on many platforms.

Game Scraper Free-Game-Scraper is a useful script that allows you to track down free games and DLCs on many platforms. Join the discord About The Proj

KursK 2 Mar 28, 2022
An utility library to scrape data from TikTok, Instagram, Twitch, Youtube, Twitter or Reddit in one line!

Social Media Scraper An utility library to scrape data from TikTok, Instagram, Twitch, Youtube, Twitter or Reddit in one line! Go to the website » Vie

2 Aug 03, 2022
Jobinja.ir jobs scraper.

Jobinja.ir Dataset Introduction This project is a simple web scraper that scraps pages of jobinja.ir concurrently and writes and update (if file gets

Iman Kermani 3 Apr 15, 2022
A module for CME that spiders hashes across the domain with a given hash.

hash_spider A module for CME that spiders hashes across the domain with a given hash. Installation Simply copy hash_spider.py to your CME module folde

37 Sep 08, 2022
The open-source web scrapers that feed the Los Angeles Times California coronavirus tracker.

The open-source web scrapers that feed the Los Angeles Times' California coronavirus tracker. Processed data ready for analysis is available at datade

Los Angeles Times Data and Graphics Department 51 Dec 14, 2022
feapder 是一款简单、快速、轻量级的爬虫框架。以开发快速、抓取快速、使用简单、功能强大为宗旨。支持分布式爬虫、批次爬虫、多模板爬虫,以及完善的爬虫报警机制。

feapder 是一款简单、快速、轻量级的爬虫框架。起名源于 fast、easy、air、pro、spider的缩写,以开发快速、抓取快速、使用简单、功能强大为宗旨,历时4年倾心打造。支持轻量爬虫、分布式爬虫、批次爬虫、爬虫集成,以及完善的爬虫报警机制。 之

boris 1.4k Dec 29, 2022
热搜榜-python爬虫+正则re+beautifulsoup+xpath

仓库简介 微博热搜榜, 参数wb 百度热搜榜, 参数bd 360热点榜, 参数360 csdn热榜接口, 下方查看 其他热搜待加入 如何使用? 注册vercel fork到你的仓库, 右上角 点击这里完成部署(一键部署) 请求参数 vercel配置好的地址+api?tit=+参数(仓库简介有参数信息

Harry 3 Jul 08, 2022
A Python module to bypass Cloudflare's anti-bot page.

cloudflare-scrape A simple Python module to bypass Cloudflare's anti-bot page (also known as "I'm Under Attack Mode", or IUAM), implemented with Reque

3k Jan 04, 2023
Fundamentus scrapy

Fundamentus_scrapy Baixa informacões que os outros scrapys do fundamentus não realizam. Para iniciar (python main.py), sera criado um arquivo chamado

Guilherme Silva Uchoa 1 Oct 24, 2021
京东云无线宝积分推送,支持查看多设备积分使用情况

JDRouterPush 项目简介 本项目调用京东云无线宝API,可每天定时推送积分收益情况,帮助你更好的观察主要信息 更新日志 2021-03-02: 查询绑定的京东账户 通知排版优化 脚本检测更新 支持Server酱Turbo版 2021-02-25: 实现多设备查询 查询今

雷疯 199 Dec 12, 2022
爬虫案例合集。包括但不限于《淘宝、京东、天猫、豆瓣、抖音、快手、微博、微信、阿里、头条、pdd、优酷、爱奇艺、携程、12306、58、搜狐、百度指数、维普万方、Zlibraty、Oalib、小说、招标网、采购网、小红书》

lxSpider 爬虫案例合集。包括但不限于《淘宝、京东、天猫、豆瓣、抖音、快手、微博、微信、阿里、头条、pdd、优酷、爱奇艺、携程、12306、58、搜狐、百度指数、维普万方、Zlibraty、Oalib、小说网站、招标采购网》 简介: 时光荏苒,记不清写了多少案例了。

lx 793 Jan 05, 2023
A Python module to bypass Cloudflare's anti-bot page.

cloudscraper A simple Python module to bypass Cloudflare's anti-bot page (also known as "I'm Under Attack Mode", or IUAM), implemented with Requests.

VeNoMouS 2.6k Dec 31, 2022
A modern CSS selector implementation for BeautifulSoup

Soup Sieve Overview Soup Sieve is a CSS selector library designed to be used with Beautiful Soup 4. It aims to provide selecting, matching, and filter

Isaac Muse 151 Dec 23, 2022
Web Scraping Framework

Grab Framework Documentation Installation $ pip install -U grab See details about installing Grab on different platforms here http://docs.grablib.

2.3k Jan 04, 2023
Web scrapper para cotizar articulos

WebScrapper Este web scrapper esta desarrollado en python 3.10.0 para buscar en la pagina de cyber puerta articulos dentro del catalogo. El programa t

Jordan Gaona 1 Oct 27, 2021