{"id":38122264,"url":"https://github.com/go-crawler/douban-movie","last_synced_at":"2026-01-16T22:29:52.403Z","repository":{"id":47295091,"uuid":"126118677","full_name":"go-crawler/douban-movie","owner":"go-crawler","description":"Golang爬虫 爬取豆瓣电影Top250","archived":false,"fork":false,"pushed_at":"2020-02-02T05:01:02.000Z","size":4,"stargazers_count":149,"open_issues_count":1,"forks_count":66,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-06-18T21:42:26.510Z","etag":null,"topics":["crawler","douban","go","golang","movie","spider"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/go-crawler.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-21T03:34:57.000Z","updated_at":"2024-05-27T07:48:37.000Z","dependencies_parsed_at":"2022-08-26T11:10:23.894Z","dependency_job_id":null,"html_url":"https://github.com/go-crawler/douban-movie","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/go-crawler/douban-movie","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-crawler%2Fdouban-movie","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-crawler%2Fdouban-movie/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-crawler%2Fdouban-movie/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-crawler%2Fdouban-movie/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/go-crawler","download_url":"https://codeload.github.com/go-crawler/douban-movie/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-crawler%2Fdouban-movie/sbom","scorecard":{"id":431624,"data":{"date":"2025-08-11","repo":{"name":"github.com/go-crawler/douban-movie","commit":"73b936237b8a6e9c5aee22f86fd2394261eae502"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.6,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Code-Review","score":0,"reason":"Found 0/3 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-19T03:29:01.605Z","repository_id":47295091,"created_at":"2025-08-19T03:29:01.605Z","updated_at":"2025-08-19T03:29:01.605Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28485360,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T11:59:17.896Z","status":"ssl_error","status_checked_at":"2026-01-16T11:55:55.838Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["crawler","douban","go","golang","movie","spider"],"created_at":"2026-01-16T22:29:52.308Z","updated_at":"2026-01-16T22:29:52.375Z","avatar_url":"https://github.com/go-crawler.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 爬取豆瓣电影 Top250\r\n\r\n爬虫是标配了，第一个就从最最最简单的爬虫开始写起吧\r\n\r\n## 目标\r\n\r\n我们的目标站点是 [豆瓣电影 Top250](https://movie.douban.com/top250)，估计大家都很眼熟了\r\n\r\n本次爬取8个字段，用于简单的概括分析。具体的字段如下：\r\n\r\n![image](https://i.loli.net/2018/03/20/5ab11596b8810.png)\r\n\r\n简单的分析一下目标源\r\n- 一页共25条\r\n- 含分页（共10页）且分页规则是正常的\r\n- 每一项的数据字段排序都是规则且不变\r\n\r\n## 开始\r\n\r\n由于量不大，我们的爬取步骤如下\r\n- 分析页面，获取所有的分页\r\n- 分析页面，循环爬取所有页面的电影信息\r\n- 爬取的电影信息入库\r\n\r\n### 安装\r\n```\r\n$ go get -u github.com/PuerkitoBio/goquery\r\n```\r\n\r\n### 运行\r\n```\r\n$ go run main.go\r\n```\r\n\r\n### 代码片段\r\n\r\n#### 1、获取所有分页\r\n```\r\nfunc ParsePages(doc *goquery.Document) (pages []Page) {\r\n\tpages = append(pages, Page{Page: 1, Url: \"\"})\r\n\tdoc.Find(\"#content \u003e div \u003e div.article \u003e div.paginator \u003e a\").Each(func(i int, s *goquery.Selection) {\r\n\t\tpage, _ := strconv.Atoi(s.Text())\r\n\t\turl, _ := s.Attr(\"href\")\r\n\r\n\t\tpages = append(pages, Page{\r\n\t\t\tPage: page,\r\n\t\t\tUrl:  url,\r\n\t\t})\r\n\t})\r\n\r\n\treturn pages\r\n}\r\n```\r\n\r\n#### 2、分析豆瓣电影信息\r\n```\r\nfunc ParseMovies(doc *goquery.Document) (movies []Movie) {\r\n\tdoc.Find(\"#content \u003e div \u003e div.article \u003e ol \u003e li\").Each(func(i int, s *goquery.Selection) {\r\n\t\ttitle := s.Find(\".hd a span\").Eq(0).Text()\r\n\r\n\t\t...\r\n\r\n\t\tmovieDesc := strings.Split(DescInfo[1], \"/\")\r\n\t\tyear := strings.TrimSpace(movieDesc[0])\r\n\t\tarea := strings.TrimSpace(movieDesc[1])\r\n\t\ttag := strings.TrimSpace(movieDesc[2])\r\n\r\n\t\tstar := s.Find(\".bd .star .rating_num\").Text()\r\n\r\n\t\tcomment := strings.TrimSpace(s.Find(\".bd .star span\").Eq(3).Text())\r\n\t\tcompile := regexp.MustCompile(\"[0-9]\")\r\n\t\tcomment = strings.Join(compile.FindAllString(comment, -1), \"\")\r\n\r\n\t\tquote := s.Find(\".quote .inq\").Text()\r\n\r\n\t\t...\r\n\r\n\t\tlog.Printf(\"i: %d, movie: %v\", i, movie)\r\n\r\n\t\tmovies = append(movies, movie)\r\n\t})\r\n\r\n\treturn movies\r\n}\r\n```\r\n\r\n\r\n### 数据\r\n![image](https://i.loli.net/2018/03/21/5ab1309594741.png)\r\n\r\n![image](https://i.loli.net/2018/03/21/5ab131ca582f8.png)\r\n\r\n![image](https://i.loli.net/2018/03/21/5ab130d3a00d9.png)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgo-crawler%2Fdouban-movie","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgo-crawler%2Fdouban-movie","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgo-crawler%2Fdouban-movie/lists"}