mcpField
S
social-media-trends-research

social-media-trends-research

github.com/drshailesh88マーケティング・グロース6710 回インストール24 週間前に更新
リポジトリ

social-media-trends-research について

Social Media Trends Researchは、検索やソーシャルプラットフォームの話題を追うマーケターや調査担当者向けのスキルです。Google TrendsとReddit用のPython手順に、他のプラットフォーム向けのPerplexity MCPクエリ例を組み合わせています。

主な機能

  1. 01Google Trendsの関心度と関連クエリを取得
  2. 02Redditの投稿と反応を検索
  3. 03Perplexity MCPのクエリ例でソーシャルトレンドを調査
  4. 04付属のトレンド調査・Redditスクレイパーを実行
  5. 05リクエストを制限し複数プラットフォームの情報を照合

活用シーン

  1. 01ニッチなキーワードの日次変化を確認
  2. 02Redditの週間議論と反応を調査
  3. 03検索とソーシャルのトレンドを比較
  4. 04コンテンツ企画向けのトレンド情報を収集

MCP 対応

Perplexity MCPのクエリ例を使い、Twitter/X、TikTok、YouTube、LinkedInのトレンドを調査します。Claude内蔵のMCP、またはperplexity-searchスキルで利用する方法も記載されています。

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/drshailesh88/integrated_content_os --skill social-media-trends-research

インストール後、Claude Code で/social-media-trends-researchを入力して読み込まれたか確認します。

同梱ファイルscripts/reddit_scraper.pyscripts/trend_research.py

詳細

ソーシャルメディアのトレンド調査

概要

3つの無料ツールを使ったプログラムによるトレンド調査です。

  • pytrends:Google Trends のデータ(勢い、ボリューム、関連クエリ)
  • yars:API キーなしで Reddit をスクレイピング
  • Perplexity MCP:Twitter/TikTok/Web のトレンド(Claude に組み込まれた MCP 経由)

このスキルは、実行可能なトレンド調査コードを提供します。戦略には content-marketing-social-listening、詳細なクエリには perplexity-search と併用してください。

クイックセットアップ

# Install dependencies (one-time)
pip install pytrends requests --break-system-packages

API キーは不要です。Reddit のスクレイピングには公開 .json エンドポイントを使用します。


ツール 1:pytrends(Google Trends)

提供される機能
  • 国別のリアルタイム検索トレンド
  • キーワードの時間経過に伴う関心度
  • 関連クエリ(上昇中=勢いの指標)
  • 地域別の関心度
  • 関連トピック
基本的な使い方
from pytrends.request import TrendReq
import time

# Initialize (no API key needed)
pytrends = TrendReq(hl='en-US', tz=330)  # tz=330 for India (IST)

# Get real-time trending searches
trending = pytrends.trending_searches(pn='india')
print(trending.head(20))
ニッチなキーワードを調査する
from pytrends.request import TrendReq
import time

pytrends = TrendReq(hl='en-US', tz=330)

# Define your niche keywords (max 5 per request)
keywords = ['heart health', 'cardiology', 'cholesterol']

# Build payload
pytrends.build_payload(keywords, timeframe='now 7-d', geo='IN')

# Get interest over time
interest = pytrends.interest_over_time()
print(interest)

# CRITICAL: Wait between requests to avoid rate limiting
time.sleep(3)

# Get related queries (THIS IS GOLD - shows rising topics)
related = pytrends.related_queries()
for kw in keywords:
    print(f"\n=== Rising queries for '{kw}' ===")
    rising = related[kw]['rising']
    if rising is not None:
        print(rising.head(10))
バイラル/急上昇トピックを見つける
from pytrends.request import TrendReq
import time

pytrends = TrendReq(hl='en-US', tz=330)

def find_breakout_topics(keyword, geo=''):
    """Find topics with explosive growth (potential viral content)"""
    pytrends.build_payload([keyword], timeframe='today 3-m', geo=geo)
    time.sleep(3)  # Rate limiting
    
    related = pytrends.related_queries()
    rising = related[keyword]['rising']
    
    if rising is not None:
        # Filter for breakout topics (marked as "Breakout" or very high %)
        breakouts = rising[rising['value'] >= 1000]  # 1000%+ growth
        return breakouts
    return None

# Example usage
breakouts = find_breakout_topics('heart health', geo='IN')
print(breakouts)
pytrends のレート制限ルール
import time

# SAFE: 1 request per 3-5 seconds for casual use
time.sleep(5)

# BULK RESEARCH: 1 request per 60 seconds
time.sleep(60)

# If you get rate limited (429 error): Wait 60-120 seconds, then continue
# If persistent issues: Wait 4-6 hours before resuming
便利な期間
期間用途
'now 1-H'直近1時間(リアルタイムの急上昇)
'now 4-H'直近4時間
'now 1-d'直近24時間
'now 7-d'直近7日間(トレンドの把握に最適)
'today 1-m'直近30日間
'today 3-m'直近90日間(勢いの分析)
'today 12-m'直近1年間(季節的なパターン)

ツール 2:Reddit(API キー不要・公開 JSON エンドポイント)

提供される機能
  • 任意のキーワードで Reddit を検索
  • サブレディットから人気順/上位/急上昇の投稿を取得
  • 投稿のエンゲージメントデータ(アップボート、コメント)
  • 認証不要
基本的な使い方
import requests
import time

headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'}

# Search Reddit for your niche
url = "https://www.reddit.com/search.json?q=heart+health&limit=10&sort=relevance&t=week"
response = requests.get(url, headers=headers, timeout=10)
data = response.json()

# Display results
for child in data.get('data', {}).get('children', []):
    post = child.get('data', {})
    print(f"Title: {post.get('title')}")
    print(f"Subreddit: r/{post.get('subreddit')}")
    print(f"Score: {post.get('score')}")
    print("---")
特定のサブレディットから人気の投稿を取得する
import requests
import time

headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'}

# Define subreddits relevant to your niche
subreddits = ['cardiology', 'health', 'medicine']

for sub in subreddits:
    print(f"\n=== Hot in r/{sub} ===")
    try:
        url = f"https://www.reddit.com/r/{sub}/hot.json?limit=10"
        response = requests.get(url, headers=headers, timeout=10)
        data = response.json()
        
        for child in data.get('data', {}).get('children', [])[:5]:
            post = child.get('data', {})
            print(f"- [{post.get('score')}] {post.get('title')[:60]}...")
    except Exception as e:
        print(f"Error: {e}")
    
    time.sleep(3)  # Rate limiting between requests
同梱の Reddit スクレイパーを使う

ヘルパークラスは scripts/reddit_scraper.py に含まれています。

from scripts.reddit_scraper import SimpleRedditScraper

scraper = SimpleRedditScraper()

# Search
results = scraper.search("heart health tips", limit=20)
for post in results['posts']:
    print(f"[{post['score']}] r/{post['subreddit']}: {post['title']}")

# Get subreddit hot posts
results = scraper.get_subreddit("health", sort="hot", limit=10)
for post in results['posts']:
    print(f"[{post['score']}] {post['title']}")
Reddit のレート制限ルール
import time

# SAFE: 1 request per 2-3 seconds
time.sleep(3)

# If you get 429 errors: Wait 5-10 minutes
# Never do more than 60 requests per hour

ツール 3:Perplexity MCP(Twitter/TikTok/Web)

直接スクレイピングできないプラットフォームには、Claude に組み込まれた Perplexity MCP を使用してください。

トレンド調査用のクエリテンプレート

Twitter/X のトレンド:

"What are the most discussed [YOUR NICHE] topics on Twitter/X this week? 
Include specific examples of viral tweets and their engagement."

TikTok のトレンド(インドから利用可能):

"What [YOUR NICHE] content is trending on TikTok right now? 
Include hashtags, view counts, and content formats that are working."

YouTube のトレンド:

"What [YOUR NICHE] videos are getting the most views on YouTube this week? 
Include channel names, view counts, and video topics."

LinkedIn のプロフェッショナル向けトレンド:

"What [YOUR NICHE] topics are professionals discussing on LinkedIn this week? 
Include examples of high-engagement posts."

全般的なバイラルコンテンツ:

"What [YOUR NICHE] content has gone viral across social media in the past 7 days? 
Include platform, format, and why it resonated."
perplexity-search スキルと Perplexity を使う

perplexity-search スキルがインストールされている場合:

python scripts/perplexity_search.py \
  "What cardiology topics are trending on Twitter and TikTok this week? Include specific viral posts and hashtags." \
  --model sonar-pro

組み合わせて使う調査ワークフロー

トレンド調査関数の全体例
from pytrends.request import TrendReq
import requests
import time
import json
from datetime import datetime

class TrendResearcher:
    def __init__(self):
        self.pytrends = TrendReq(hl='en-US', tz=330)
        self.reddit_headers = {
            'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'
        }
    
    def _reddit_request(self, url):
        """Make a Reddit API request."""
        try:
            response = requests.get(url, headers=self.reddit_headers, timeout=10)
            response.raise_for_status()
            return response.json()
        except Exception as e:
            return {'error': str(e)}
    
    def research_niche(self, keywords, subreddits=None, geo='IN'):
        """
        Complete trend research for a niche.
        
        Args:
            keywords: List of keywords (max 5)
            subreddits: List of subreddit names to monitor
            geo: Geographic region code
        
        Returns:
            Dictionary with all research data
        """
        results = {
            'timestamp': datetime.now().isoformat(),
            'keywords': keywords,
            'google_trends': {},
            'reddit': {},
            'recommendations': []
        }
        
        # 1. Google Trends - Interest Over Time
        print("📊 Fetching Google Trends data...")
        try:
            self.pytrends.build_payload(keywords[:5], timeframe='now 7-d', geo=geo)
            results['google_trends']['interest'] = self.pytrends.interest_over_time().to_dict()
            time.sleep(5)
            
            # Related queries (rising topics)
            related = self.pytrends.related_queries()
            results['google_trends']['rising_queries'] = {}
            for kw in keywords[:5]:
                rising = related[kw]['rising']
                if rising is not None:
                    results['google_trends']['rising_queries'][kw] = rising.head(10).to_dict()
            time.sleep(5)
        except Exception as e:
            results['google_trends']['error'] = str(e)
        
        # 2. Reddit Research
        print("👽 Fetching Reddit discussions...")
        if subreddits:
            for sub in subreddits[:5]:
                try:
                    url = f"https://www.reddit.com/r/{sub}/hot.json?limit=10"
                    data = self._reddit_request(url)
                    posts = []
                    for child in data.get('data', {}).get('children', [])[:5]:
                        post = child.get('data', {})
                        posts.append({
                            'title': post.get('title', ''),
                            'score': post.get('score', 0),
                            'comments': post.get('num_comments', 0)
                        })
                    results['reddit'][sub] = posts
                    time.sleep(3)
                except Exception as e:
                    results['reddit'][sub] = {'error': str(e)}
        
        # 3. Keyword search on Reddit
        print("🔍 Searching Reddit for keywords...")
        for kw in keywords[:3]:
            try:
                url = f"https://www.reddit.com/search.json?q={kw}&limit=10&sort=relevance&t=week"
                data = self._reddit_request(url)
                posts = []
                for child in data.get('data', {}).get('children', [])[:5]:
                    post = child.get('data', {})
                    posts.append({
                        'title': post.get('title', ''),
                        'subreddit': post.get('subreddit', ''),
                        'score': post.get('score', 0),
                        'comments': post.get('num_comments', 0)
                    })
                results['reddit'][f'search_{kw}'] = posts
                time.sleep(3)
            except Exception as e:
                results['reddit'][f'search_{kw}'] = {'error': str(e)}
        
        # 4. Generate recommendations
        results['recommendations'] = self._generate_recommendations(results)
        
        return results
    
    def _generate_recommendations(self, data):
        """Generate content recommendations from research data"""
        recommendations = []
        
        # From rising queries
        rising = data.get('google_trends', {}).get('rising_queries', {})
        for kw, queries in rising.items():
            if isinstance(queries, dict) and 'query' in queries:
                for query in list(queries['query'].values())[:3]:
                    recommendations.append({
                        'source': 'Google Trends',
                        'topic': query,
                        'reason': f"Rising search term related to '{kw}'"
                    })
        
        # From Reddit hot posts
        for sub, posts in data.get('reddit', {}).items():
            if isinstance(posts, list):
                for post in posts[:2]:
                    if post.get('score', 0) > 50:
                        recommendations.append({
                            'source': f'Reddit r/{sub}',
                            'topic': post.get('title', ''),
                            'reason': f"High engagement ({post.get('score')} upvotes)"
                        })
        
        return recommendations

# Usage Example
if __name__ == "__main__":
    researcher = TrendResearcher()
    
    results = researcher.research_niche(
        keywords=['heart health', 'cardiology', 'cholesterol'],
        subreddits=['cardiology', 'health', 'medicine'],
        geo='IN'
    )
    
    # Save results
    with open('trend_research.json', 'w') as f:
        json.dump(results, f, indent=2, default=str)
    
    # Print recommendations
    print("\n🎯 CONTENT RECOMMENDATIONS:")
    for rec in results['recommendations']:
        print(f"- [{rec['source']}] {rec['topic']}")
        print(f"  Why: {rec['reason']}")

クイックリファレンスコマンド

毎日のトレンド確認(5分)
from pytrends.request import TrendReq
import requests
import time

# Quick Google Trends check
pytrends = TrendReq(hl='en-US', tz=330)
pytrends.build_payload(['your keyword'], timeframe='now 1-d')
print(pytrends.related_queries()['your keyword']['rising'])

time.sleep(5)

# Quick Reddit check  
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'}
url = "https://www.reddit.com/search.json?q=your+keyword&limit=10&t=day"
response = requests.get(url, headers=headers, timeout=10)
data = response.json()
for child in data.get('data', {}).get('children', [])[:5]:
    post = child.get('data', {})
    print(f"[{post.get('score')}] {post.get('title')}")
週次の詳細調査
# Use the TrendResearcher class above with:
# - 5 core keywords
# - 5 relevant subreddits
# - 90-day timeframe for velocity analysis

# Then use Perplexity MCP for:
# - Twitter trends in your niche
# - TikTok viral content
# - YouTube trending videos
# - LinkedIn discussions

ライティングスキルとの連携

調査後、結果をライティングスキルに渡してください。

1. Run trend research (this skill)
2. Identify top 3-5 opportunities
3. Use content-marketing-social-listening for strategy
4. Use cardiology-content-repurposer or similar for content creation
5. Use authentic-voice for final polish

トラブルシューティング

pytrends の問題
エラー解決方法
429 Too Many Requests60秒待ってから、スリープ時間を延ばします
結果が空キーワードに検索ボリュームがあるか確認します
接続エラーインターネット接続を確認し、5分後に再試行します
Reddit の問題
エラー解決方法
429 Rate Limited10分待ちます
サブレディットが見つからないサブレディット名のスペルを確認します
結果が空サブレディットが非公開、または隔離されている可能性があります
接続タイムアウトタイムアウトを延長し、インターネット接続を確認します

ベストプラクティス

  1. 必ずレート制限を設ける:リクエストの間に待機します
  2. まとめて調査する:常時ポーリングせず、週次で詳細調査を行います
  3. 結果を保存する:調査データをローカルにキャッシュします
  4. 複数の情報源を照合する:複数のプラットフォームでトレンドを検証します
  5. すばやく行動する:バイラルになる期間は短いです(24~72時間)

プラットフォーム対応状況の概要

プラットフォームツールコストリスク
Google Trendspytrends無料非常に低い
Redditrequests(公開 JSON)無料低い
Twitter/XPerplexity MCP無料*なし
TikTokPerplexity MCP無料*なし
YouTubePerplexity MCP無料*なし
LinkedInPerplexity MCP無料*なし

*Claude に組み込まれた MCP を使うか、perplexity-search スキルを使用する場合は OpenRouter クレジットを使います


同梱リソース

  • scripts/trend_research.py:トレンド調査を一通り行うためのメイン CLI ツール
  • scripts/reddit_scraper.py:シンプルな Reddit スクレイパークラス(API キー不要)

コメント