Giter Site home page Giter Site logo

morvanzhou / easy-scraping-tutorial Goto Github PK

View Code? Open in Web Editor NEW
763.0 763.0 552.0 3.34 MB

Simple but useful Python web scraping tutorial code.

Home Page: https://morvanzhou.github.io/tutorials/data-manipulation/scraping/

License: MIT License

Jupyter Notebook 91.71% Python 8.29%
asyncio beautifulsoup crawler crawling distributed-scraper regex requests scraping scrapy urllib

easy-scraping-tutorial's People

Contributors

morvanzhou avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

easy-scraping-tutorial's Issues

d_jan

In [3]:
jan = soup.find('ul', {"class": 'jan'})
d_jan = jan.find_all('li') # use jan as a parent --> this cannot work, jan is a list already.
for d in d_jan:
print(d.get_text())
一月一号
一月二号
一月三号

The code doesn't work

In the code of requests.post().
I don't why you code can only print('Hello there, !') even change Chinese into English.

data = {'firstname': '莫烦', 'lastname': '周'}
r = requests.post('http://pythonscraping.com/files/processing.php', data=data)
print(r.text)
# Hello there, 莫烦 周!

Best Wish!

运行4-1distributed scraping 报错

Distributed Crawling...

Distributed Parsing...
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
File "C:\PYTHON\lib\multiprocessing\pool.py", line 125, in worker
result = (True, func(*args, **kwds))
File "D:\sublime\mofan爬虫教程\4-1-distributed-scraping.py", line 18, in parse
page_urls = set([urljoin(base_url, url['href']) for url in urls]) # remove duplication
File "D:\sublime\mofan爬虫教程\4-1-distributed-scraping.py", line 18, in
page_urls = set([urljoin(base_url, url['href']) for url in urls]) # remove duplication
NameError: name 'base_url' is not defined
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "4-1-distributed-scraping.py", line 49, in
results = [j.get() for j in parse_jobs] # parse html
File "4-1-distributed-scraping.py", line 49, in
results = [j.get() for j in parse_jobs] # parse html
File "C:\PYTHON\lib\multiprocessing\pool.py", line 771, in get
raise self._value
NameError: name 'base_url' is not defined

Repl Closed

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.