Removed API dependency for Tags - #803
Conversation
…o access the static tag files rather than sending an API get request. Removed all methods calling the API so the tags cannot be edited, added nor deleted.
…ering of points on github
…d of caching it after the tags command is used.
lemonsaurus
left a comment
There was a problem hiding this comment.
Please rewrite this to make full use of pathlib instead of leaning on the os module to solve most of the problems for you. we shouldn't need to import os at all for this file.
The pathlib module simplifies opening and reading files, hence the os module and the context manager are no longer used.
"get_tags()" and "_get_tag()" functions need not be async as we are no longer doing any API call but instead reading from local files.
|
Hey @RohanJnr, recently more pre-commit hooks were added. I'm not sure if you don't have the pre-commit hook installed or if it just failed to update and include the new hooks for you. You may need to merge master first. CI is failing because the new hooks remove trailing whitespaces and ensure final newlines in files. Some of the tag markdown files you added have those issues. If you run |
|
The new hooks have been merged & the tag files updated for the new linting. Please be sure to pull down the changes before making more commits, and ensure that your linting environment has been updated appropriately. |
MarkKoz
left a comment
There was a problem hiding this comment.
Since there's only one command now, a command group is no longer necessary. Be mindful of existing aliases in alias.py when you go to remove the group.
|
|
||
| For reference, this usage is covered by the following clauses in [YouTube's TOS](https://www.youtube.com/static?template=terms), as of 2019-07-22: | ||
| ``` | ||
| The following restrictions apply to your use of the Service. You are not allowed to: |
There was a problem hiding this comment.
Not sure why the language regarding redistribution was removed from this tag:
- access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as expressly authorized by the Service; or (b) with prior written permission from YouTube and, if applicable, the respective rights holders;
- use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service); or
There was a problem hiding this comment.
I removed it because it is just a side effect of youtube-dl, this tool in itself is only against 3rd paragraph, the first and 9th paragraph are about redistributibg the content created by tool such as youtube-dl, but aren't directly caused by it. For instance I could download my music collection using it and keep it on my computer, and it would only be against the 3rd paragraph.
There was a problem hiding this comment.
The overwhelming majority of use cases encountered on our server utilize ytdl to stream content with a discord bot, which is redistributing content outside of YouTube’s platform. That is why these sections were all included and why they should remain in the tag.
Please ask questions on these things before unilaterally making a decision to remove them.
There was a problem hiding this comment.
It just didn't made sense to me based on what was already in the tag.
MarkKoz
left a comment
There was a problem hiding this comment.
The tag search command is broken:
AttributeError: 'Tags' object has no attribute '_get_tags'
As far as I can see, everything else is fine. Fix the above error and this PR should be good to go.
The tags have now been shifted from the database to being static files and hence the get_tags() method has undergone changes. It now dosen't fetch from the database but looks at the local files and we need not call it more than once.
* Add a constant for the footer text * Import constants module rather than its classes
Fixed `!tag search any` raises `AttributeError`. Changed default value of `keywords` from `None` to `'any'`. This will make it search for keyword `'any'` when there is no keyword.
closes #777
This PR is to remove the API dependency for the
Tagsand use static files instead, so adding, editing or deleting of a tag will happen only through a PR and not from a discord bot command.