From 50e99aec8022bb330e61e99444bd99d9201b9690 Mon Sep 17 00:00:00 2001 From: msjk27 <97681606+msjk27@users.noreply.github.com> Date: Sun, 29 Oct 2023 19:05:16 +0900 Subject: [PATCH 1/4] added tweets_crawling (#17) feat - tweets_crawling made --- modules/crawling/tweets_crawling.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/modules/crawling/tweets_crawling.py b/modules/crawling/tweets_crawling.py index 8b13789..ec6557c 100644 --- a/modules/crawling/tweets_crawling.py +++ b/modules/crawling/tweets_crawling.py @@ -1 +1,14 @@ +import tweepy +# 트위터 개발자 계정에서 얻은 키들을 아래에 입력하세요. +def tweets_crawling(consumer_key, consumer_secret, access_token, access_token_secret, keyword): + auth = tweepy.OAuthHandler(consumer_key, consumer_secret) + auth.set_access_token(access_token, access_token_secret) + + api = tweepy.API(auth) + + # 특정 키워드가 포함된 트윗을 검색합니다. + public_tweets = api.search(q=keyword, lang="ko", count=5) + + for tweet in public_tweets: + print(tweet.text) From 2e23f18bd6c08787dce21362351c6fa2631f2fc7 Mon Sep 17 00:00:00 2001 From: msjk27 <97681606+msjk27@users.noreply.github.com> Date: Sun, 29 Oct 2023 19:14:49 +0900 Subject: [PATCH 2/4] Update tweets_crawling.py --- modules/crawling/tweets_crawling.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/crawling/tweets_crawling.py b/modules/crawling/tweets_crawling.py index ec6557c..7120012 100644 --- a/modules/crawling/tweets_crawling.py +++ b/modules/crawling/tweets_crawling.py @@ -10,5 +10,5 @@ def tweets_crawling(consumer_key, consumer_secret, access_token, access_token_se # 특정 키워드가 포함된 트윗을 검색합니다. public_tweets = api.search(q=keyword, lang="ko", count=5) - for tweet in public_tweets: - print(tweet.text) + return public_tweets + From 570f9bfa54d7d1dd6d0237b4344f9602f21fc56e Mon Sep 17 00:00:00 2001 From: Hyun NamGung Date: Sun, 29 Oct 2023 19:40:28 +0900 Subject: [PATCH 3/4] =?UTF-8?q?feat:=20fakedao=20=EA=B5=AC=ED=98=84=20=20(?= =?UTF-8?q?#20)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: Keyword FastDao * amend * feat: article dao 구현 * feat: Community dao 구현 * feat: trend dao 구현 * feat: article keyword 구현 * feat: article keyword 구현 * amend article keyword --------- Co-authored-by: dwl21 --- .../keyword_fixture.cpython-37.pyc | Bin 0 -> 938 bytes dao/_keyword.py | 13 ++++++++ dao/article.py | 13 ++++++++ dao/article_dao.py | 31 ++++++++++++++++++ dao/article_keyword.py | 12 +++++++ dao/article_keyword_dao.py | 31 ++++++++++++++++++ dao/community.py | 11 +++++++ dao/community_dao.py | 31 ++++++++++++++++++ dao/keyword_dao.py | 31 ++++++++++++++++++ dao/trend.py | 7 ++++ dao/trend_dao.py | 31 ++++++++++++++++++ 11 files changed, 211 insertions(+) create mode 100644 dao/__pycache__/keyword_fixture.cpython-37.pyc create mode 100644 dao/_keyword.py create mode 100644 dao/article.py create mode 100644 dao/article_dao.py create mode 100644 dao/article_keyword.py create mode 100644 dao/article_keyword_dao.py create mode 100644 dao/community.py create mode 100644 dao/community_dao.py create mode 100644 dao/keyword_dao.py create mode 100644 dao/trend.py create mode 100644 dao/trend_dao.py diff --git a/dao/__pycache__/keyword_fixture.cpython-37.pyc b/dao/__pycache__/keyword_fixture.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9e53dff6bd8a804130e9080901d4285a2196dca9 GIT binary patch literal 938 zcmY*X&rcIk5Pt7%TiV)6MFi9f@zxl@iwBd2AQ}lVauF{Zb+hTL*wF5l{h>C21nAa7 zDG@^r#k8g-#z4ZM5KKzMe`K$oVBh`&oP2NBMxA8l&Ca~}=G!+jl}yGFlj6+@#l;By z;vYR3WX>d0;{`K-0OwHwix{J61Ox;dfuP{BAQA{c7$VRIQHVhtE49~1=`fvYxBLW)qv4^SD4VYv1LrLUi|9w?2S*pzH2k2O&8Ssv+$z??~@ z#tmi^Bw|1!dCEA60>cUe$si@dP9ei$3@_yLJyJ?l6YPd>&hL)19t%cM z&MM=@lKDzgZ!O5C{GSi9Hog#$kzVHBnwGAN6-zq*C9VeV7smtDQZzo>;r(fgl)xGkHduY?@S5cUKI46>OGeM@y zid*#Xh_b~1Lu_7GiW816OtbXopZ_?HgJ#NtLhI?%LX>X@No4WzfvF%m6 zj0*?iJkL5Sw7lx=)V=qc)({JLt49o$e(Jbe%~AT}$lKcWY84;n?EC&%cO@X+YPdF% zJf6wt3^S`0iWB^S48lwV=>zPTO-ICNu>`Ve=CV3Z_yZJ^y;<{hGMt#AS_MUyO~r}+ g$r%51@mGnra-x}FA163fgU1sj6^Y|Gj^dQ?8{JAJ#sB~S literal 0 HcmV?d00001 diff --git a/dao/_keyword.py b/dao/_keyword.py new file mode 100644 index 0000000..1fbc93b --- /dev/null +++ b/dao/_keyword.py @@ -0,0 +1,13 @@ +from pydantic import BaseModel + +class Keyword(BaseModel): + id: int = None + name: str + + +keyword_names = [ + "삼성전자", "코로나 백신", "올림픽", "메타버스", "NFT", + "AI", "블록체인", "테슬라", "애플", "에이치엘비", + "환율", "비트코인", "가상화폐", "클라우드 컴퓨팅", + "구글", "유튜브", "방탄소년단", "빅데이터", "5G", "IoT" +] diff --git a/dao/article.py b/dao/article.py new file mode 100644 index 0000000..2f5b3d1 --- /dev/null +++ b/dao/article.py @@ -0,0 +1,13 @@ +from pydantic import BaseModel + +class Article(BaseModel): + id: int = None + title: str + body: str + reporter: str + media: str + link: str + time: str + + +article_fixtures = [] diff --git a/dao/article_dao.py b/dao/article_dao.py new file mode 100644 index 0000000..b07aedd --- /dev/null +++ b/dao/article_dao.py @@ -0,0 +1,31 @@ +from typing import Optional +from article import article + +articles_db = {} + +def save(name: str) -> Optional[Article]: + if name not in articles_db.values(): + article = Article(id=len(articles_db) + 1, name=name) + articles_db[article.id] = article + return article + return None + + +def find(id: int) -> Optional[Article]: + if id in articles_db: + return articles_db[id] + return None + + +def find_all() -> list: + return list(articles_db.values()) + + +def edit(article: Article): + if article.id in articles_db: + articles_db[id] = article + + +def delete(article: Article): + if article.id in articles_db: + articles_db.pop(article.id) diff --git a/dao/article_keyword.py b/dao/article_keyword.py new file mode 100644 index 0000000..5b80509 --- /dev/null +++ b/dao/article_keyword.py @@ -0,0 +1,12 @@ +from pydantic import BaseModel +from article import Article +from _keyword import Keyword + + +class ArticleKeyword(BaseModel): + id: int = None + article: Article + keyword: Keyword + + +article_keyword_fixtures = [] diff --git a/dao/article_keyword_dao.py b/dao/article_keyword_dao.py new file mode 100644 index 0000000..20795e7 --- /dev/null +++ b/dao/article_keyword_dao.py @@ -0,0 +1,31 @@ +from typing import Optional +from article_keyword import ArticleKeyword + +article_keywords_db = {} + +def save(name: str) -> Optional[ArticleKeyword]: + if name not in article_keywords_db.values(): + article_keyword = ArticleKeyword(id=len(article_keywords_db) + 1, name=name) + article_keywords_db[article_keyword.id] = article_keyword + return article_keyword + return None + + +def find(id: int) -> Optional[ArticleKeyword]: + if id in article_keywords_db: + return article_keywords_db[id] + return None + + +def find_all() -> list: + return list(article_keywords_db.values()) + + +def edit(article_keyword: ArticleKeyword): + if article_keyword.id in article_keywords_db: + article_keywords_db[id] = article_keyword + + +def delete(article_keyword: ArticleKeyword): + if article_keyword.id in article_keywords_db: + article_keywords_db.pop(article_keyword.id) diff --git a/dao/community.py b/dao/community.py new file mode 100644 index 0000000..e77bb09 --- /dev/null +++ b/dao/community.py @@ -0,0 +1,11 @@ +from pydantic import BaseModel + +class Community(BaseModel): + id: int = None + source: str + body: str + link: str + time: str + + +community_fixtures = [] diff --git a/dao/community_dao.py b/dao/community_dao.py new file mode 100644 index 0000000..d932f19 --- /dev/null +++ b/dao/community_dao.py @@ -0,0 +1,31 @@ +from typing import Optional +from _community import community + +communitys_db = {} + +def save(name: str) -> Optional[Community]: + if name not in communitys_db.values(): + community = Community(id=len(communitys_db) + 1, name=name) + communitys_db[community.id] = community + return community + return None + + +def find(id: int) -> Optional[Community]: + if id in communitys_db: + return communitys_db[id] + return None + + +def find_all() -> list: + return list(communitys_db.values()) + + +def edit(community: Community): + if community.id in communitys_db: + communitys_db[id] = community + + +def delete(community: Community): + if community.id in communitys_db: + communitys_db.pop(community.id) diff --git a/dao/keyword_dao.py b/dao/keyword_dao.py new file mode 100644 index 0000000..ace9445 --- /dev/null +++ b/dao/keyword_dao.py @@ -0,0 +1,31 @@ +from typing import Optional +from _keyword import Keyword + +keywords_db = {} + +def save(name: str) -> Optional[Keyword]: + if name not in keywords_db.values(): + keyword = Keyword(id=len(keywords_db) + 1, name=name) + keywords_db[keyword.id] = keyword + return keyword + return None + + +def find(id: int) -> Optional[Keyword]: + if id in keywords_db: + return keywords_db[id] + return None + + +def find_all() -> list: + return list(keywords_db.values()) + + +def edit(keyword: Keyword): + if keyword.id in keywords_db: + keywords_db[id] = keyword + + +def delete(keyword: Keyword): + if keyword.id in keywords_db: + keywords_db.pop(keyword.id) diff --git a/dao/trend.py b/dao/trend.py new file mode 100644 index 0000000..04a6cb2 --- /dev/null +++ b/dao/trend.py @@ -0,0 +1,7 @@ +from pydantic import BaseModel + +class Trend(BaseModel): + id: int = None + time: str + +trend_fixtures = [] diff --git a/dao/trend_dao.py b/dao/trend_dao.py new file mode 100644 index 0000000..2888966 --- /dev/null +++ b/dao/trend_dao.py @@ -0,0 +1,31 @@ +from typing import Optional +from _trend import trend + +trends_db = {} + +def save(name: str) -> Optional[Trend]: + if name not in trends_db.values(): + trend = Trend(id=len(trends_db) + 1, name=name) + trends_db[trend.id] = trend + return trend + return None + + +def find(id: int) -> Optional[Trend]: + if id in trends_db: + return trends_db[id] + return None + + +def find_all() -> list: + return list(trends_db.values()) + + +def edit(trend: Trend): + if trend.id in trends_db: + trends_db[id] = trend + + +def delete(trend: Trend): + if trend.id in trends_db: + trends_db.pop(trend.id) From 0de3eb13b4b72756bf293b35daf506023cd8e1e4 Mon Sep 17 00:00:00 2001 From: Hyun NamGung Date: Sun, 29 Oct 2023 19:41:05 +0900 Subject: [PATCH 4/4] Update README.md --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a7375c5..d9371ee 100644 --- a/README.md +++ b/README.md @@ -7,11 +7,13 @@ ## KATA 소개 ![kata](https://github.com/Team-KATA/python-kata/assets/76774809/c74de953-e41a-4b96-9aa6-b54d55743809) ### Republic of Korea Army Trend Analysis (KATA) -### 대한민국 육군 트랜드 분석 서비스 +### 대한민국 육군 트렌드 분석 서비스 국방 및 안보 이슈에 중점을 두고, 사회적 관심사로 부상하는 키워드를 선정한다. 선택된 키워드와 관련된 기사 반응을 분석하고 요약하여, 사용자가 해당 키워드에 대한 감정 변화, 여론 추이 및 예측 등을 종합적으로 파악할 수 있게 지원하는 도구이다. KATA는 국방분야에서의 빅데이터 활용을 통한 새로운 가치 창출을 목표로 하고 있다. 이를 통해 육군이 보다 효과적으로 정보를 분석하고, 더 빠르고 정확한 결정을 내릴 수 있도록 돕고자 한다. +[바로가기](https://kata-front.run.goorm.site/) + ## 주요 기능 **Page Map** ![Page Map](https://github.com/Team-KATA/python-kata/assets/76774809/4d24fd32-a057-46e0-bd10-589cb596e649) @@ -30,5 +32,5 @@ KATA는 국방분야에서의 빅데이터 활용을 통한 새로운 가치 창 | [허동석](https://github.com/POBSIZ) | [석민석](https://github.com/msjk27) | [남궁현](https://github.com/DWL21) | :----------------------------------------------------------: | :----------------------------------------------------------: | :----------------------------------------------------------: | _ | _ | _ - + - 2023.10 대한민국 육군 9311부대 소속 장병