fuo-qqmusic 1.0.10__tar.gz → 1.0.12__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of fuo-qqmusic might be problematic. Click here for more details.

Files changed (21) hide show
  1. {fuo_qqmusic-1.0.10 → fuo_qqmusic-1.0.12}/PKG-INFO +1 -1
  2. {fuo_qqmusic-1.0.10 → fuo_qqmusic-1.0.12}/README.md +7 -1
  3. {fuo_qqmusic-1.0.10 → fuo_qqmusic-1.0.12}/fuo_qqmusic/api.py +15 -0
  4. {fuo_qqmusic-1.0.10 → fuo_qqmusic-1.0.12}/fuo_qqmusic/provider.py +30 -0
  5. {fuo_qqmusic-1.0.10 → fuo_qqmusic-1.0.12}/fuo_qqmusic/provider_ui.py +20 -1
  6. {fuo_qqmusic-1.0.10 → fuo_qqmusic-1.0.12}/fuo_qqmusic.egg-info/PKG-INFO +1 -1
  7. {fuo_qqmusic-1.0.10 → fuo_qqmusic-1.0.12}/setup.py +1 -1
  8. {fuo_qqmusic-1.0.10 → fuo_qqmusic-1.0.12}/fuo_qqmusic/__init__.py +0 -0
  9. {fuo_qqmusic-1.0.10 → fuo_qqmusic-1.0.12}/fuo_qqmusic/assets/icon.svg +0 -0
  10. {fuo_qqmusic-1.0.10 → fuo_qqmusic-1.0.12}/fuo_qqmusic/consts.py +0 -0
  11. {fuo_qqmusic-1.0.10 → fuo_qqmusic-1.0.12}/fuo_qqmusic/excs.py +0 -0
  12. {fuo_qqmusic-1.0.10 → fuo_qqmusic-1.0.12}/fuo_qqmusic/login.py +0 -0
  13. {fuo_qqmusic-1.0.10 → fuo_qqmusic-1.0.12}/fuo_qqmusic/schemas.py +0 -0
  14. {fuo_qqmusic-1.0.10 → fuo_qqmusic-1.0.12}/fuo_qqmusic.egg-info/SOURCES.txt +0 -0
  15. {fuo_qqmusic-1.0.10 → fuo_qqmusic-1.0.12}/fuo_qqmusic.egg-info/dependency_links.txt +0 -0
  16. {fuo_qqmusic-1.0.10 → fuo_qqmusic-1.0.12}/fuo_qqmusic.egg-info/entry_points.txt +0 -0
  17. {fuo_qqmusic-1.0.10 → fuo_qqmusic-1.0.12}/fuo_qqmusic.egg-info/requires.txt +0 -0
  18. {fuo_qqmusic-1.0.10 → fuo_qqmusic-1.0.12}/fuo_qqmusic.egg-info/top_level.txt +0 -0
  19. {fuo_qqmusic-1.0.10 → fuo_qqmusic-1.0.12}/setup.cfg +0 -0
  20. {fuo_qqmusic-1.0.10 → fuo_qqmusic-1.0.12}/tests/test_api.py +0 -0
  21. {fuo_qqmusic-1.0.10 → fuo_qqmusic-1.0.12}/tests/test_provider.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fuo_qqmusic
3
- Version: 1.0.10
3
+ Version: 1.0.12
4
4
  Summary: feeluown qqmusic plugin
5
5
  Home-page: https://github.com/feeluown/feeluown-qqmusic
6
6
  Author: Cosven
@@ -20,7 +20,13 @@ pip3 install fuo-qqmusic
20
20
  [操作示例](https://github.com/feeluown/feeluown-qqmusic/issues/6)。
21
21
 
22
22
  ## changelog
23
- ### 1.1.10 (2025-07-29)
23
+ ### 1.0.12 (2025-09-22)
24
+ - 支持展示歌曲评论
25
+
26
+ ### 1.0.11 (2025-08-12)
27
+ - 尝试修复wx登录有时会失败的问题
28
+
29
+ ### 1.0.10 (2025-07-29)
24
30
  - 修复歌曲链接会失效的问题(仅 FeelUOwn>=4.1.14 可用)
25
31
 
26
32
  ### 1.0.9 (2025-07-24)
@@ -17,6 +17,14 @@ logger = logging.getLogger(__name__)
17
17
 
18
18
  api_base_url = 'http://c.y.qq.com'
19
19
 
20
+ class CodeShouldBe200(QQIOError):
21
+ def __init__(self, data):
22
+ self._code = data['code']
23
+ self._data = data
24
+
25
+ def __str__(self):
26
+ return f'json code field should be 200, got {self._code}. data: {self._data}'
27
+
20
28
 
21
29
  def djb2(string):
22
30
  ''' Hash a word using the djb2 algorithm with the specified base. '''
@@ -449,6 +457,13 @@ class API(object):
449
457
  }
450
458
  js = self.rpc(data)
451
459
  return js['req_0']['data']
460
+
461
+ def get_comment(self, comment_id):
462
+ url = api_base_url + f'/base/fcgi-bin/fcg_global_comment_h5.fcg?biztype=1&cmd=8&topid={comment_id}&pagenum=0&pagesize=25'
463
+ res_data = requests.get(url, headers=self._headers)
464
+ if res_data.status_code == 200:
465
+ return res_data.json()
466
+ raise CodeShouldBe200(res_data)
452
467
 
453
468
  def get_lyric_by_songmid(self, songmid):
454
469
  url = api_base_url + '/lyric/fcgi-bin/fcg_query_lyric_new.fcg'
@@ -3,11 +3,14 @@ from typing import List, Optional, Protocol, Tuple
3
3
  from feeluown.excs import ModelNotFound
4
4
  from feeluown.library import (
5
5
  AbstractProvider,
6
+ BriefCommentModel,
6
7
  BriefSongModel,
7
8
  BriefPlaylistModel,
9
+ BriefUserModel,
8
10
  PlaylistModel,
9
11
  Collection,
10
12
  CollectionType,
13
+ CommentModel,
11
14
  ProviderV2,
12
15
  ProviderFlags as PF,
13
16
  SupportsSongGet,
@@ -30,6 +33,7 @@ from feeluown.library import (
30
33
  SupportsCurrentUserChanged,
31
34
  SimpleSearchResult,
32
35
  SearchType,
36
+ ModelState,
33
37
  ModelType,
34
38
  UserModel,
35
39
  )
@@ -193,6 +197,32 @@ class QQProvider(AbstractProvider, ProviderV2):
193
197
  must not return None with a valid quality.
194
198
  """
195
199
  return list(self._song_get_q_media_mapping(song))
200
+
201
+ def song_list_hot_comments(self, song):
202
+ logger.info(f'Fetching hot comments for song: {song.title}({song.identifier})')
203
+ data = self.api.get_comment(song.identifier)
204
+ hot_comments_data = data["hot_comment"]["commentlist"]
205
+ hot_comments = []
206
+ for comment_data in hot_comments_data:
207
+ user = BriefUserModel(
208
+ identifier='',
209
+ source=SOURCE,
210
+ name=comment_data['nick'],
211
+ state=ModelState.not_exists,
212
+ )
213
+ comment = CommentModel(
214
+ identifier=str(comment_data["commentid"]),
215
+ source=SOURCE,
216
+ user=user,
217
+ content=comment_data["rootcommentcontent"],
218
+ liked_count=comment_data["praisenum"],
219
+ time=comment_data["time"],
220
+ parent=None,
221
+ root_comment_id=str(comment_data["rootcommentcontent"])
222
+ )
223
+ hot_comments.append(comment)
224
+ return hot_comments
225
+
196
226
 
197
227
  def song_get_media(self, song, quality: Quality.Audio) -> Optional[Media]:
198
228
  """Get song's media by a specified quality
@@ -38,8 +38,27 @@ class ProviderUI(AbstractProviderUi):
38
38
  #
39
39
  # - keys: ['skey']
40
40
  url = os.getenv('FUO_QQMUSIC_LOGIN_URL', 'https://y.qq.com')
41
+ # NOTE(cosven): 经过一番探索,我‘观察’到,wx的快捷登录还挺方便,
42
+ # 它可以识别到我浏览器当前登录的wx账户。它是怎样识别到我的账户的呢?
43
+ # 理论上可以在第一次扫码的时候,在浏览器开发者工具中抓包,看 set-cookie 字段就知道了。
44
+ # 我目前怀疑是大概率是 _qimei 相关的字段,但不太确认,一下子也没找到很可靠的资料。
45
+ #
46
+ # 另外,值得备注的是,我发现登录后,会有一些 oauth 相关字段存在 cookie 里面,
47
+ # 对于wx登录这种方式来说,我猜测它没有被用上。猜测的依据是:每隔一两天,
48
+ # 无论是网页版,还是我们这里的逻辑,都需要通过“微信快捷登录”来登录。
49
+ # 而我们这里目前根本没用使用 refresh_token 做任何事情。
50
+ #
51
+ # 不过还是备注一下,wx 登录的话,下面字段或许可以用来刷新 cookie
52
+ # 'wxunionid', 'wxrefresh_token'
53
+ # qq 登录的话,下面几个字段或许可以用来刷新 cookie
54
+ # 'psrf_access_token_expiresAt',
55
+ # 'psrf_musickey_createtime',
56
+ # 'psrf_qqaccess_token',
57
+ # 'psrf_qqopenid',
58
+ # 'psrf_qqrefresh_token',
41
59
  keys_str = os.getenv('FUO_QQMUSIC_LOGIN_COOKIE_KEYS',
42
- 'qqmusic_key,wxuin|qqmusic_key,uin')
60
+ ('qqmusic_key,wxuin,qm_keyst'
61
+ '|qqmusic_key,uin,qm_keyst'))
43
62
  self._dialog = LoginDialog(url, [keys.split(',') for keys in keys_str.split('|')])
44
63
  self._dialog.login_succeed.connect(self.on_login_succeed)
45
64
  self._dialog.show()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fuo_qqmusic
3
- Version: 1.0.10
3
+ Version: 1.0.12
4
4
  Summary: feeluown qqmusic plugin
5
5
  Home-page: https://github.com/feeluown/feeluown-qqmusic
6
6
  Author: Cosven
@@ -5,7 +5,7 @@ from setuptools import setup
5
5
 
6
6
  setup(
7
7
  name='fuo_qqmusic',
8
- version='1.0.10',
8
+ version='1.0.12',
9
9
  description='feeluown qqmusic plugin',
10
10
  author='Cosven',
11
11
  author_email='yinshaowen241@gmail.com',
File without changes