Reddit::Posts - Reddit投稿スクレイパー

Reddit::Posts スクレイパーの概要
Reddit::Posts - Redditの投稿を抽出するスクレイパーです。同名のサービスから、メッセージ(投稿)のリストと各投稿に関する詳細情報を収集します。
クエリの自動増殖、ファイルからのサブクエリの置換、英数字の組み合わせやリストの反復処理を使用して、可能な限り多くの結果を取得できます。
A-Parserの機能により、Reddit::Posts スクレイパーの設定を将来の使用のために保存(プリセット)したり、スクレイピングのスケジュールを設定したりすることが可能です。
内蔵された強力なテンプレートエンジン Template Toolkit により、結果にロジックを適用し、JSON、SQL、CSV を含む様々なフォーマットでデータを抽出するなど、必要な形式と構造で結果を保存できます。
収集データ
メッセージ(投稿)の配列:
- 投稿へのリンク
- タイトルとラベル (flair)
- レーティング、コメント数、アワード数
- 作成日
- 投稿が公開されたコミュニティ
- 著者と著者のラベル (flair)
- 投稿内容: markdown形式のテキスト、メディアコンテンツへのリンク、外部リソースへのリンク
- 広告投稿かどうか
機能
- スクレイピングするページ数の指定
- 結果のソート方法の指定
- 結果の期間選択
- 特定のコミュニティ内でのスクレイピング機能
ユースケース
- Reddit上のメッセージ(投稿)に関するデータを取得する必要があるあらゆるシナリオ
クエリ
いくつかのクエリ形式をサポートしています:
トピックへのリンク
例:
https://www.reddit.com/t/bitcoin/
https://www.reddit.com/t/kim_kardashian/
デフォルトでは、以下のような投稿リンクのリストが出力されます:
https://www.reddit.com/r/Bitcoin/comments/14nbyy2/i_took_out_a_35000_loan_to_buy_bitcoin_1_year/
https://www.reddit.com/r/CryptoCurrency/comments/14guprs/bitcoin_is_up_75_since_jim_cramer_told_investors/
https://www.reddit.com/r/Bitcoin/comments/14opp2t/this_guy_was_paid_32_bitcoin_to_hold_up_this_sign/
https://www.reddit.com/r/CryptoCurrency/comments/14ivx43/nearly_69_of_all_bitcoin_supply_did_not_move_in/
https://www.reddit.com/r/CryptoCurrency/comments/149vy0o/bitcoin_dips_below_25k_for_the_first_time_in_3/
...
コミュニティへのリンク
リンク内の期間やソートを指定するパラメータも考慮されます。その際、設定で指定された値は無視されます。例:
https://www.reddit.com/r/nba/
https://www.reddit.com/r/OrlandoMagic/top/?t=month
デフォルトでは、以下のような投稿リンクのリストが出力されます:
https://www.reddit.com/r/OrlandoMagic/comments/14a5br2/
https://www.reddit.com/r/OrlandoMagic/comments/14nqfk1/keep_mo_or_no_mo/
https://www.reddit.com/r/nba/comments/14nfzki/202324_nba_free_agent_tracker/
https://www.reddit.com/user/Grammarly/comments/14ghtld/verbessere_deine_schreibfertigkeit_auf_englisch/
https://www.reddit.com/r/nba/comments/14r4l4s/vernon_dillon_brooks_took_991_shots_last_year_he/
https://www.reddit.com/r/nba/comments/14ql1es/highlight_matt_devlin_inexplicably_yells_punjabi/
https://www.reddit.com/user/TelekomShop/comments/yqkina/der_highspeedhotspot_zum_mitnehmen_die_speedbox/
https://www.reddit.com/r/nba/comments/14qysvi/michael_jordan_with_the_spin_hanging_onehanded/
https://www.reddit.com/r/nba/comments/14qxrep/dwyane_wade_leads_the_redeem_team_with_27_points/
...
キーワード
例:
wordpress features
parser
デフォルトでは、以下のような投稿リンクのリストが出力されます:
https://www.reddit.com/r/ShitpostXIV/comments/14511em/i_am_a_proud_grey_parser/
https://www.reddit.com/r/opengl/comments/147sbjk/4_hours_of_my_obj_parser_so_far/
https://www.reddit.com/r/Compilers/comments/14pi9xh/demystifying_pratt_parsers/
https://www.reddit.com/r/ZETTAHOST/comments/11qdg99/how_to_change_the_wordpress_featured_image_size/
https://www.reddit.com/r/Wordpress/comments/14p1k2p/what_features_is_wordpress_missing_i_want_to_help/
https://www.reddit.com/r/Wordpress/comments/13q8g5x/is_it_possible_and_advisable_to_build_a_website/
...
キーワードとコミュニティへのリンク
スクレイパーは特定のコミュニティ内でのキーワード検索をサポートしています。これを行うには、クエリにキーワードを入力し、スペースを空けてコミュニティのリンクを指定します。例:
jesus https://www.reddit.com/r/atheism/
stage 3 https://www.reddit.com/r/Audi/
デフォルトでは、以下のような投稿リンクのリストが出力されます:
https://www.reddit.com/r/Audi/comments/vi6cs5/thoughts_on_used_stage_3_2017_a3/
https://www.reddit.com/r/Audi/comments/lfvjuo/just_picked_up_this_beauty_stage_3_b5_s4/
https://www.reddit.com/r/Audi/comments/ssr8ui/anyone_else_track_their_audis_ttrs_stage_3_big/
https://www.reddit.com/r/atheism/comments/14lq0y6/heaven_and_hell_are_not_what_jesus_preached/
https://www.reddit.com/r/atheism/comments/13gxzj6/so_jesus_freaks_can_shove_their_religion_onto/
https://www.reddit.com/r/atheism/comments/13b8kl6/chris_pratt_compares_his_struggles_to_jesus/
https://www.reddit.com/r/atheism/comments/137k88b/artwork_of_jesus_surrounded_by_hot_leather/
...
結果の出力オプション
A-Parserは、内蔵のテンプレートエンジン Template Toolkit により柔軟な結果フォーマットをサポートしており、任意の形式やCSV、JSONなどの構造化された形式で結果を出力できます。
設定可能な項目
| パラメータ | デフォルト値 | 説明 |
|---|---|---|
| Pages count | 5 | 取得するページ数 |
| Sort | Relevance | 結果のソート順 |
| Time | All time | 結果の対象期間 |
| Use HTTP/2 transport | ☑ | HTTP/1.1の代わりにHTTP/2を使用するかどうかを指定します |