webbotparseR
1.0.0
webbotparseR อนุญาตให้แยกวิเคราะห์ผลลัพธ์ของเครื่องมือค้นหาที่คัดลอกมาจากส่วนขยายเบราว์เซอร์ WebBot ไลบรารีหลามที่คล้ายกันก็มีให้เช่นกัน
คุณสามารถติดตั้ง webbotparseR เวอร์ชันพัฒนาได้ดังนี้:
remotes :: install_github( " schochastics/webbotparseR " )
แพ็คเกจประกอบด้วยตัวอย่าง html จากการค้นหาของ Google เกี่ยวกับการเปลี่ยนแปลงสภาพภูมิอากาศ
library( webbotparseR )
ex_file <- system.file( " www.google.com_climatechange_text_2023-03-16_08_16_11.html " , package = " webbotparseR " )
ผลการค้นหาดังกล่าวสามารถแยกวิเคราะห์ได้ผ่านฟังก์ชัน parse_search_results()
engine
พารามิเตอร์ใช้เพื่อระบุเครื่องมือค้นหาและประเภทการค้นหา
output <- parse_search_results( path = ex_file , engine = " google text " )
output
# > # A tibble: 10 × 10
# > title link text image page position search_engine type query
# > <chr> <chr> <chr> <chr> <chr> <int> <chr> <chr> <chr>
# > 1 What Is Climate C… http… Clim… data… 1 1 www.google.c… text clim…
# > 2 Home – Climate Ch… http… Vita… data… 1 2 www.google.c… text clim…
# > 3 Vital Signs of th… http… “Cli… data… 1 3 www.google.c… text clim…
# > 4 Climate change - … http… In c… data… 1 4 www.google.c… text clim…
# > 5 IPCC — Intergover… http… The … data… 1 5 www.google.c… text clim…
# > 6 Climate Change | … http… Comp… data… 1 6 www.google.c… text clim…
# > 7 Climate change: e… http… Clim… <NA> 1 7 www.google.c… text clim…
# > 8 UNFCCC http… What… data… 1 8 www.google.c… text clim…
# > 9 Climate Change - … http… Clim… data… 1 9 www.google.c… text clim…
# > 10 Causes of climate… http… This… data… 1 10 www.google.c… text clim…
# > # ℹ 1 more variable: date <dttm>
โปรดทราบว่ารูปภาพจะถูกส่งกลับโดยเข้ารหัส base64 เสมอ
output $ image [ 1 ]
# > [1] "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAABnRSTlMAAAAAAABupgeRAAAAMklEQVR4AWMAgYYG4hEdNJAHGoCIABvBJayhgcYaIAwaakCwydUA52MKYeeSCgZh4gMAXrJ9ASggqqAAAAAASUVORK5CYII="
ฟังก์ชัน base64_to_img()
สามารถใช้เพื่อถอดรหัสรูปภาพและบันทึกในรูปแบบที่เหมาะสม