Eisa01 / mpv-scripts

This repository contain scripts I have made for mpv media player...
BSD 2-Clause "Simplified" License
504 stars 35 forks source link

SmartCopyPaste can't handle url #88

Closed IC0hO closed 1 year ago

IC0hO commented 1 year ago

when I 'm using mypikpak.com to watch video and try to use mpv play videos,SmartCopyPaste can't handle url but it working by command line.

The url example: https://dl-a10b-0470.mypikpak.com/download/?fid=dOHnexeOK-Ae7in9NFuvxIOqNp-31BcxVel5PwSr9qUHhp9pQUsufEgs3eujDjp4EKkh6ZP3jKCIyme42Gpue2DoZzT-vUu_tJ2oJhKlEDU=&from=5&verno=3&prod=1104&expire=1683982949&g=01A8C46F7D8D6D873DD9422EF36B9ACD0F607B9D&ui=ZFwm6KZKGnYUMXdu&t=0&ms=10400000&th=10400000&f=1151940397&alt=0&userid=ZFwm6KZKGnYUMXdu&fileid=VNV70RSxgTto3ZwD8T_Tzagvo1&pr=XQPkPvr9WWiIuMvELmrVevbj3HuMCDXIpD1zlpsagV9sU30UxYRJKuJ4RQHVSAyj5uneBXMtbZZe_K3afCl_YqINQBb83KFQv0UHYoHgvUmgU4qQqbFHZShx7SPFpBvrsPuoppcAxl4a8jgKgB0-5ASwMTUQMLY7hNudRkJ0P4pQJvxfoWnWOijkEKTSvx1hgFmzCE-nKbHAXMF_S79ddarBOFoGsDHtmLwJ2PVyQjclFj-Qph_NcaION7_6im2WO5QzNs1RWBxbTCsYbKDRxhZCi9Q3Ze3UPD3KKjRiOnjrHG58e8FSG_f8OJRu9V1YRIKLk1Y40yHe6FbVlux4BA==&sign=5DD9A99A60ACD4A960E5453B499156BF

I checked the url I saw in the playlist when using SmartCopyPaste: https://dl-a10b-0470.mypikpak.com/download/?fid=dOHnexeOK-Ae7in9NFuvxIOqNp-31BcxVel5PwSr9qUHhp9pQUsufEgs3eujDjp4EKkh6ZP3jKCIyme42Gpue2DoZzT-vUu_tJ2oJhKlEDU=&from=5&verno=3&prod=1104&expire=1683982949&g=01A8C46F7D8D6D873DD9422EF36B9ACD0F607B9D&ui=ZFwm6KZKGnYUMXdu

The url passed in by SmartCopyPaste seems to be incomplete.

Eisa01 commented 1 year ago

This is because the url contains &t= which is usually expected to be the final parameter after a url. You can change the default attribute in the config file by making something like

protocols_time_attribute=&time= instead of &t=

Or you can add an exception for this mypikpak website to not have a time attribute.

specific_time_attributes=[ ["mypikpak", "", ""], ["twitter", "?t=", ""], ["twitch", "?t=", "s"], ["youtube", "&t=", "s"] ]

IC0hO commented 1 year ago

I see,I 've used protocols_time_attribute=&time= instead of &t= and now it can work.

I prefer add an exception for mypikpak website to no have a time attribute and add ["mypikpak", "", ""] to my SmartCopyPaste.conf.After adding the parameters, it still cannot play properly. Is this the correct parameter?

IC0hO commented 1 year ago

I tested it and found out that it's not "or," both of them need to be set in order to use it.

In my SmartCopyPaste.conf: specific_time_attributes=[ ["mypikpak", "", ""], ["twitter", "?t=", ""], ["twitch", "?t=", "s"], ["youtube", "&t=", "s"] ] protocols_time_attribute=&time=

Eisa01 commented 1 year ago

You're right, it seems that protocols_time_attribute takes priority over specific_time_attributes. So actually only removing protocols_time_attribute is enough.

What you can actually do is follow a whitelist approach where protocols_time_attribute= is empty, and only add websites that need to look for specific time using specific_time_attributes. So keep it as per the default: specific_time_attributes=[ ["twitter", "?t=", ""], ["twitch", "?t=", "s"], ["youtube", "&t=", "s"] ]

Later I will probably update this to be the default config.

IC0hO commented 1 year ago

Okay, thank you for your help.