Xác định bạn là ai với user agent tùy chỉnh

Web Scraping bằng R

Timo Grossenbacher

Instructor

Hãy tự giới thiệu!

  • Máy chủ web đã ghi nhận địa chỉ IP của bạn
  • Tốt hơn là tự nhận diện rõ ràng
  • Có một HTTP header cho việc đó!

Một ví dụ request

1 https://developer.mozilla.org/en-US/docs/Web/HTTP/Overview
Web Scraping bằng R

Sửa header với httr

response <- GET('http://example.com', user_agent("Hey, it's me, Timo! 
    Reach me at [email protected]."))

Cách khác:

set_config(add_headers(`User-Agent` = "Hey, it's me, Timo!
    Reach me at [email protected]."))
response <- GET('http://example.com')
Web Scraping bằng R

Hãy thử nhé!

Web Scraping bằng R

Preparing Video For Download...