Kenalkan diri dengan user agent kustom

Web Scraping di R

Timo Grossenbacher

Instructor

Tunjukkan identitas Anda!

  • Server web sudah mencatat alamat IP Anda
  • Lebih baik identifikasi diri Anda secara eksplisit
  • Ada header HTTP untuk itu!

Contoh permintaan

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

Ubah header dengan httr

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

Atau:

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

Ayo berlatih!

Web Scraping di R

Preparing Video For Download...