小编Mic*_*ken的帖子

如何从无限滚动网站刮取所有内容?scrapy

我正在使用scrapy.

我正在使用的网站有无限滚动.

该网站有很多帖子,但我只刮了13.

如何刮掉其余帖子?

这是我的代码:

class exampleSpider(scrapy.Spider):
name = "example"
#from_date = datetime.date.today() - datetime.timedelta(6*365/12)
allowed_domains = ["example.com"]
start_urls = [
    "http://www.example.com/somethinghere/"
]

def parse(self, response):
  for href in response.xpath("//*[@id='page-wrap']/div/div/div/section[2]/div/div/div/div[3]/ul/li/div/h1/a/@href"):
    url = response.urljoin(href.extract())
    yield scrapy.Request(url, callback=self.parse_dir_contents)


def parse_dir_contents(self, response):
    #scrape contents code here
Run Code Online (Sandbox Code Playgroud)

python sitemap web-crawler scrapy web-scraping

8
推荐指数
3
解决办法
8703
查看次数

当我点击其中的内容时,LaTeX hyperref 链接会转到错误的页面

我想问如何使用 \hyperref 因为我已经在谷歌上搜索了大量答案,但我找不到。我创建了自己的目录。然后我包含了 \hyperref 包。然后内容会自动成为超链接,这很好。但随后它就转到了错误的页面。我用谷歌搜索了很多,但找不到答案。我点击的内容转到了错误的页面。

\documentclass[10pt,a4paper]{report}

\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{enumerate}

\usepackage{hyperref}
% %\usepackage[colorlinks]{hyperref}


% %\renewcommand*{\contentsname}{\hyperlink{contents}{Contents}}
% %\renewcommand*{\contentsname}{\hyperref[contents]{\arabic{page}}}

\begin{document}

\input{coverPage}
\maketitle

\tableofcontents
\addcontentsline{toc}{chapter}{Table of Contents}
\pagebreak

\addcontentsline{toc}{chapter}{List of Figures}
\listoffigures
\pagebreak

% % (1) ==============================================
\setcounter{chapter}{1}
\addcontentsline{toc}{chapter}{1. Introduction}
\input{introduction}
\pagebreak

\addcontentsline{toc}{chapter}{2. References}
\input{references}
\pagebreak

\addcontentsline{toc}{chapter}{3. Glossary}
\input{glossary}
\pagebreak

\end{document}
Run Code Online (Sandbox Code Playgroud)

latex tex hyperref tableofcontents

6
推荐指数
1
解决办法
7863
查看次数