Git Product home page Git Product logo

lihkgr's Introduction

LIHKGr

LIHKGr

The goal of LIHKGr is to scrape text data on the LIHKG, the Hong Kong version of Reddit, for analysis. LIHKG has gained popularity in 2016 and become a popular research data source during recent years. LIHKG is currently protected by Google's reCAPTCHA, this package currently builds on rselenium and adopts a semi-manual approach to bypass it.

Instructions

lihkgr.R contains all the required functions. Please install the following packages: RSelenium, raster, magrittr, and rvest and follow the following workflows:

  1. Run the R sciprt to load the packages and define all the functions.
  2. Set working directory, temporary files will be stored here.
  3. Run init_scraper() to initiate scraper. Specify the range of post ids to scrape.
  4. Run launch_browser() and solve reCAPTCHA when needed. The default browser is Chrome (77.0.3865.40), change browser and version if neccessary. This function builts on RSelenium::rsDriver(), see help file for more information about supported browsers.
  5. Run start_scraping() to strat scrapping. The function currently produces the following files: LIHKGr.RData which saves the workspace, lihkg_df.rds and lihkg_df.csv which save the dataframe as .rds and .csv respectively, and lihkg_df_postid.txt which save the last scraped post id.

If the browser has crashed, repeat step 4 and 5. If R has crashed, read in LIHKGr.RData and repeat step 4 and 5.

Known Issues / To-do List

  • Create R package using devtools
  • Create arguments for specifying file outputs.
  • Debug error scrapping empty last page
  • Debug error scraping hidden posts

Contributors

  • Justin Chun-ting Ho
  • Nick H. K. Or

Citation

Ho, J.C. & Or, N.H.K. (2020). LIHKGr. An application for scraping LIHKG. Source code and releases available at https://github.com/justinchuntingho/LIHKGr.

lihkgr's People

Contributors

justinchuntingho avatar

Watchers

James Cloos avatar

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.