Giter Site home page Giter Site logo

youtube_comment_crawler's Introduction

🐽 Youtube_Comment_Crawler

유튜브 댓글 크롤러 ( Python, BeautifulSoup, Selenium )

🗃 사용 라이브러리

  • BeautifulSoup
  • Selenium
  • pandadas
  • requests

📝 참고 페이지 - https://bit.ly/2yyl7F5

🖥 세부 설명

💻 get_urls_from_youtube_with_keyword(keyword) 💻

  • 원하는 키워드에 대한 유튜브 영상 제목과 URL을 Crawling 하는 함수
  • 여러 영상의 제목을 담은 titles와 URL을 담은 urls를 return 함

💻 crawl_youtube_page_html_sources(urls) 💻

  • 여러 영상에 대한 url을 담은 urls 리스트를 인자로 받음
  • 각 URL 마다 Selenium으로 접근하여 댓글이 모두 로딩 될 수 있도록 스크롤을 시행하고
  • 스크롤이 끝나면 HTML 코드를 Crawl한 후
  • 리스트에 담아 return 함

💻 get_user_IDs_and_comments(html_sources) 💻

  • HTML 소스코드가 담겨있는 리스트를 인자로 받음
  • 각 페이지 소스코드에서 댓글 데이터 부분만 추출하고
  • 리뷰 데이터에서 ID값과 댓글 부분을 추출한 후
  • 페이지 별로 DataFrame형식으로 만든 뒤
  • 모든 페이지에 대한 DataFrame을 리스트에 담아 return 함

💻 convert_csv_from_dataframe(titles, my_dataframe) 💻

  • 영상의 제목들이 담긴 titles와 ID, comment 정보가 담긴 dataframe들이 들어있는 my_dataframe 리스트를 인자로 받음
  • titles의 제목들에서 특수문자를 제거한 제목을 csv 파일의 이름으로 사용하여
  • 각각의 dataframe을 to_csv 를 활용해 csv파일로 저장함

youtube_comment_crawler's People

Contributors

somjang avatar

Watchers

 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.