Skip to content

Commit 4976c4e

Browse files
authored
Merge pull request #114 from funswift/feature/#______/change
wip:仕組みの変更(カテゴリに表示する投稿など変更)、変数の修正
2 parents 20891e3 + bd64637 commit 4976c4e

File tree

7 files changed

+70
-125
lines changed

7 files changed

+70
-125
lines changed

back/Twitter.py

+21-66
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
# 除外ユーザ
2626
# @ri_Zu_n_ 競馬のうるさいユーザ
2727
# @KY1225kataware なんでやねん函館関係ないやろの人
28-
# @Miyabi207Vzs72 インスタでもうるさいr_18アカウント
28+
# @Miyabi207Vzs72 インスタでもうるさいr_18アカウント(雅とかいうアカウント)
29+
# @bonzu207 上の支援アカウント
2930
# @flan_staff r_18アカウント
3031

3132
# 除外ボット
@@ -34,10 +35,10 @@
3435
# rt_10 楽天トラベル
3536

3637
#APIキーの配列 格納の順番=> [キーワード検索用API, (あつしのAPIキー)
37-
# トップページ用API, (じょざのAPIキー)
38+
# 知る用API, (じょざのAPIキー)
3839
# 食べるカテゴリ用API, (じょざのAPIキー)
39-
# ニュースカテゴリ用API, (じょざのAPIキー)
40-
# 温泉カテゴリ用API, (じょざのAPIキー)
40+
# ニュースカテゴリ用API, (じょざのAPIキー)(使ってない)
41+
# 温泉カテゴリ用API, (じょざのAPIキー)(使ってない)
4142
# 見るカテゴリ用API] (じょざのAPIキー)
4243

4344

@@ -126,7 +127,7 @@ def SaveToDatabase(tweets, tweets_data, data_label):
126127
if tweet.source != "twittbot.net" and tweet.source != "TravelRaku" and tweet.source != "rt_10" : #ここでBOTを除外する
127128
for i in range(len(tweets.includes['users'])):
128129
if tweet.author_id == tweets.includes['users'][i]['id']:
129-
if tweets.includes['users'][i]['username'] != "ri_Zu_n_" and tweets.includes['users'][i]['username'] != "KY1225kataware" and tweets.includes['users'][i]['username'] != "Miyabi207Vzs72" and tweets.includes['users'][i]['username'] != "flan_staff" :
130+
if tweets.includes['users'][i]['username'] != "ri_Zu_n_" and tweets.includes['users'][i]['username'] != "KY1225kataware" and tweets.includes['users'][i]['username'] != "Miyabi207Vzs72" and tweets.includes['users'][i]['username'] != "bonzu207" and tweets.includes['users'][i]['username'] != "flan_staff":
130131
ref.child(str(tweet.id)).set({ # キーはツイートID
131132
'data_label' : data_label,
132133
'date': -(tweet.created_at.timestamp()), #float型(確認済み)
@@ -195,8 +196,8 @@ def SearchTweets(search, tweet_max, client):
195196

196197

197198

198-
# トップページ用アカウントのタイムラインの投稿をデータベースに保存する
199-
def GetTopTimeLine(tweet_max, client):
199+
# 知るカテゴリ用アカウントのタイムラインの投稿をデータベースに保存する
200+
def GetKnowTimeLine(tweet_max, client):
200201
# 直近のツイート取得
201202
tweets = client.get_home_timeline(
202203
max_results=tweet_max,
@@ -210,12 +211,12 @@ def GetTopTimeLine(tweet_max, client):
210211
# 取得したデータ加工
211212
tweets_data = tweets.data
212213

213-
return SaveToDatabase(tweets, tweets_data, 'TopTimeLine')
214+
return SaveToDatabase(tweets, tweets_data, 'KnowTimeLine')
214215

215216

216217

217-
# ごはんカテゴリ用アカウントのタイムラインの投稿をデータベースに保存する
218-
def GetFoodTimeLine(tweet_max, client):
218+
# 食べるカテゴリ用アカウントのタイムラインの投稿をデータベースに保存する
219+
def GetEatTimeLine(tweet_max, client):
219220
# 直近のツイート取得
220221
tweets = client.get_home_timeline(
221222
max_results=tweet_max,
@@ -229,7 +230,7 @@ def GetFoodTimeLine(tweet_max, client):
229230
# 取得したデータ加工
230231
tweets_data = tweets.data
231232

232-
return SaveToDatabase(tweets, tweets_data, 'FoodTimeLine')
233+
return SaveToDatabase(tweets, tweets_data, 'EatTimeLine')
233234

234235

235236
# 使わない
@@ -272,8 +273,8 @@ def GetFoodTimeLine(tweet_max, client):
272273

273274

274275

275-
# 観光カテゴリ用アカウントのタイムラインの投稿をデータベースに保存する
276-
def GetTourTimeLine(tweet_max, client):
276+
# 見るカテゴリ用アカウントのタイムラインの投稿をデータベースに保存する
277+
def GetSeeTimeLine(tweet_max, client):
277278
# 直近のツイート取得
278279
tweets = client.get_home_timeline(
279280
max_results=tweet_max,
@@ -287,7 +288,7 @@ def GetTourTimeLine(tweet_max, client):
287288
# 取得したデータ加工
288289
tweets_data = tweets.data
289290

290-
return SaveToDatabase(tweets, tweets_data, 'TourTimeLine')
291+
return SaveToDatabase(tweets, tweets_data, 'SeeTimeLine')
291292

292293

293294

@@ -309,9 +310,9 @@ def GetTourTimeLine(tweet_max, client):
309310
# search = "函館 -is:retweet -is:reply -is:quote has:media -東京 -八王子 -札幌 -小樽 -苫小牧 OR 函館 -is:retweet -is:reply -is:quote has:links -東京 -八王子 -札幌 -小樽 -苫小牧 "
310311

311312
add_func = " -is:retweet -is:reply -is:quote has:media"
312-
place = " -東京 -羽田 -歌舞伎町 -八王子 -札幌 -すすきの -沖縄 -青森 -仙台 -山形 -鹿児島 -福島 -秋田 -盛岡 -神田 -土呂 -丘珠 -大宮 -新潟 -金沢 -苫小牧 -北見 -帯広 -室蘭 -夕張 -網走 -ニセコ -稚内 -留萌 -小樽 -釧路 -長万部 -旭川"
313-
r_18 = " -裏垢 -裏アカ -キャバ嬢 -パパ活 -風俗 -デブ専 -グラビアモデル"
314-
other = " -政権 -スープラ -runkeeper -戦争 -世界平和 -求人 -末広写真館 -函館に行ってきた -言霊アロマ"
313+
place = " -東京 -原宿 -羽田 -歌舞伎町 -八王子 -札幌 -サッポロ-すすきの -沖縄 -青森 -仙台 -山形 -沼津 -鹿児島 -福島 -秋田 -盛岡 -神田 -土呂 -丘珠 -大宮 -新潟 -金沢 -苫小牧 -北見 -帯広 -室蘭 -夕張 -網走 -ニセコ -稚内 -留萌 -小樽 -釧路 -長万部 -旭川"
314+
r_18 = " -裏垢 -裏アカ -キャバ嬢 -パパ活 -風俗 -デブ専 -グラビアモデル -病み -夜勤"
315+
other = " -政権 -スープラ -runkeeper -戦争 -世界平和 -求人 -末広写真館 -函館に行ってきた -言霊アロマ -地雷 -自撮り"
315316
# 検索対象(リツイート除外, 返信除外, 画像付きの投稿に絞る)
316317

317318
search = "函館" + add_func + place + r_18 + other
@@ -323,54 +324,8 @@ def GetTourTimeLine(tweet_max, client):
323324
pprint(SearchTweets(search, tweet_max, client[0]))
324325

325326
#カテゴリごとに、アカウントのタイムラインの投稿をデータベースに保存する関数を実行
326-
pprint(GetTopTimeLine(tweet_max, client[1]))
327-
pprint(GetFoodTimeLine(tweet_max, client[2]))
327+
pprint(GetKnowTimeLine(tweet_max, client[1]))
328+
pprint(GetEatTimeLine(tweet_max, client[2]))
328329
# pprint(GetNewsTimeLine(tweet_max, client[3])) #使わない
329330
# pprint(GetSpaTimeLine(tweet_max, client[4])) #使わない
330-
pprint(GetTourTimeLine(tweet_max, client[5]))
331-
332-
333-
334-
335-
336-
337-
338-
339-
340-
341-
342-
343-
344-
345-
346-
347-
348-
349-
350-
# テストコード
351-
# トップページ用アカウントのタイムラインの投稿をSNS_dataのキーではなく別のキーに保存する場合
352-
# Key = '格納したいキー名を書く' 今回の場合TimeLine_dataとした。何でもいいよ。
353-
354-
# Key = 'Search'
355-
# ref = db.reference(Key)
356-
# pprint(SearchTweets(search, tweet_max))
357-
358-
# Key = 'Top_data'
359-
# ref = db.reference(Key)
360-
# pprint(GetTopTimeLine(tweet_max))
361-
362-
# Key = 'Food_data'
363-
# ref = db.reference(Key) #キー名のパスにアクセス
364-
# pprint(GetFoodTimeLine(tweet_max))
365-
366-
# Key = 'News_data'
367-
# ref = db.reference(Key) #キー名のパスにアクセス
368-
# pprint(GetNewsTimeLine(tweet_max))
369-
370-
# Key = 'Spa_data'
371-
# ref = db.reference(Key) #キー名のパスにアクセス
372-
# pprint(GetSpaTimeLine(tweet_max))
373-
374-
# Key = 'Tour_data'
375-
# ref = db.reference(Key) #キー名のパスにアクセス
376-
# pprint(GetTourTimeLine(tweet_max))
331+
pprint(GetSeeTimeLine(tweet_max, client[5]))
0 Bytes
Binary file not shown.

front/HaCollect/src/App.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ export default {
5656
InitializeData() {
5757
this.$store.dispatch('InitializeFireData').then( () => {
5858
this.$store.dispatch('getTopData')
59-
this.$store.dispatch('getFoodData')
60-
this.$store.dispatch('getTourData')
61-
this.$store.dispatch('getKnowledgeData')
59+
this.$store.dispatch('getEatData')
60+
this.$store.dispatch('getSeeData')
61+
this.$store.dispatch('getKnowData')
6262
})
6363
},
6464
doSearch() {

front/HaCollect/src/components/eatPage.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ export default {
186186
},
187187
computed: {
188188
fire_data: function () {
189-
return this.$store.state.food_fire_data
189+
return this.$store.state.eat_fire_data
190190
},
191191
},
192192
};

front/HaCollect/src/components/knowPage.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ export default {
187187
},
188188
computed: {
189189
fire_data: function () {
190-
return this.$store.state.knowledge_fire_data
190+
return this.$store.state.know_fire_data
191191
},
192192
},
193193
};

front/HaCollect/src/components/seePage.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ export default {
186186
},
187187
computed: {
188188
fire_data: function () {
189-
return this.$store.state.tour_fire_data
189+
return this.$store.state.see_fire_data
190190
},
191191
},
192192
};

0 commit comments

Comments
 (0)