Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save source link in extended attribute (Mac) #2545

Open
tewe opened this issue Mar 11, 2014 · 6 comments
Open

Save source link in extended attribute (Mac) #2545

tewe opened this issue Mar 11, 2014 · 6 comments
Labels

Comments

@tewe
Copy link

@tewe tewe commented Mar 11, 2014

Browsers on the Mac set a "Where From" attribute on downloaded files. Files also have a comments field, where some people put a URL.

I implemented the latter as an external tool, and would integrate it into youtube-dl if it has any chance to be accepted. The former wouldn't be a problem, either.

@jaimeMF jaimeMF added the request label Mar 11, 2014
@phihag
Copy link
Contributor

@phihag phihag commented Mar 11, 2014

There are already the --add-metadata and --xattrs options. We are even planning to make them default (but fail silently when needed tools are missing. Do these solve your problem? If not, I'd prefer to simply check whether the OS is Mac OS X in the implementation of --add-metadata.

@tewe
Copy link
Author

@tewe tewe commented Mar 12, 2014

--xattrs is the right mechanism, but the wrong names. The Mac keeps user data but doesn't display it anywhere.

--add-metadata modifies the video itself, so personally I don't use it. The Mac shows some of those fields, but none where I could put a source URL.

@jaimeMF
Copy link
Collaborator

@jaimeMF jaimeMF commented Mar 12, 2014

I can work on this, which browsers add the webpage url?, do you know if there's some documentation for the names that are used in the xattrs?

@tewe
Copy link
Author

@tewe tewe commented Mar 12, 2014

As I said, I have working code. I'll replace --xattrs if run on Mac.

@tewe
Copy link
Author

@tewe tewe commented Mar 13, 2014

I'd send a pull request for the above but have to figure out this rebasing stuff first

@MaddTheSane
Copy link

@MaddTheSane MaddTheSane commented Oct 4, 2019

Apple's use of xattr is different than the XDG standard. From a file downloaded by Safari:

computer:~ user$ xattr -l ~/Downloads/x16emu_mac-r30.zip 
com.apple.lastuseddate#PS:
00000000  9F B8 7A 5D 00 00 00 00 EF 47 93 32 00 00 00 00  |..z].....G.2....|
00000010
com.apple.metadata:kMDItemDownloadedDate:
00000000  62 70 6C 69 73 74 30 30 A1 01 33 41 C1 95 78 0F  |bplist00..3A..x.|
00000010  EB CD 9A 08 0A 00 00 00 00 00 00 01 01 00 00 00  |................|
00000020  00 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00  |................|
00000030  00 00 00 00 13                                   |.....|
00000035
com.apple.metadata:kMDItemWhereFroms:
00000000  62 70 6C 69 73 74 30 30 A2 01 02 5F 11 02 04 68  |bplist00..._...h|
00000010  74 74 70 73 3A 2F 2F 67 69 74 68 75 62 2D 70 72  |ttps://github-pr|
00000020  6F 64 75 63 74 69 6F 6E 2D 72 65 6C 65 61 73 65  |oduction-release|
00000030  2D 61 73 73 65 74 2D 32 65 36 35 62 65 2E 73 33  |-asset-2e65be.s3|
00000040  2E 61 6D 61 7A 6F 6E 61 77 73 2E 63 6F 6D 2F 31  |.amazonaws.com/1|
00000050  39 38 33 30 38 34 35 36 2F 36 64 64 34 34 31 38  |98308456/6dd4418|
00000060  30 2D 64 35 62 33 2D 31 31 65 39 2D 38 32 39 66  |0-d5b3-11e9-829f|
00000070  2D 61 66 39 61 32 30 35 33 64 32 35 34 3F 58 2D  |-af9a2053d254?X-|
00000080  41 6D 7A 2D 41 6C 67 6F 72 69 74 68 6D 3D 41 57  |Amz-Algorithm=AW|
00000090  53 34 2D 48 4D 41 43 2D 53 48 41 32 35 36 26 58  |S4-HMAC-SHA256&X|
000000A0  2D 41 6D 7A 2D 43 72 65 64 65 6E 74 69 61 6C 3D  |-Amz-Credential=|
000000B0  41 4B 49 41 49 57 4E 4A 59 41 58 34 43 53 56 45  |AKIAIWNJYAX4CSVE|
000000C0  48 35 33 41 25 32 46 32 30 31 39 30 39 31 32 25  |H53A%2F20190912%|
000000D0  32 46 75 73 2D 65 61 73 74 2D 31 25 32 46 73 33  |2Fus-east-1%2Fs3|
000000E0  25 32 46 61 77 73 34 5F 72 65 71 75 65 73 74 26  |%2Faws4_request&|
000000F0  58 2D 41 6D 7A 2D 44 61 74 65 3D 32 30 31 39 30  |X-Amz-Date=20190|
00000100  39 31 32 54 32 31 32 39 30 31 5A 26 58 2D 41 6D  |912T212901Z&X-Am|
00000110  7A 2D 45 78 70 69 72 65 73 3D 33 30 30 26 58 2D  |z-Expires=300&X-|
00000120  41 6D 7A 2D 53 69 67 6E 61 74 75 72 65 3D 36 63  |Amz-Signature=6c|
00000130  33 38 61 37 66 66 38 64 32 63 64 37 33 64 32 64  |38a7ff8d2cd73d2d|
00000140  35 37 64 61 32 37 35 65 38 31 33 36 35 39 31 64  |57da275e8136591d|
00000150  38 35 30 63 39 33 32 65 37 65 32 62 33 35 37 37  |850c932e7e2b3577|
00000160  66 30 30 33 33 30 62 62 36 35 31 31 32 65 26 58  |f00330bb65112e&X|
00000170  2D 41 6D 7A 2D 53 69 67 6E 65 64 48 65 61 64 65  |-Amz-SignedHeade|
00000180  72 73 3D 68 6F 73 74 26 61 63 74 6F 72 5F 69 64  |rs=host&actor_id|
00000190  3D 37 31 39 34 39 32 26 72 65 73 70 6F 6E 73 65  |=719492&response|
000001A0  2D 63 6F 6E 74 65 6E 74 2D 64 69 73 70 6F 73 69  |-content-disposi|
000001B0  74 69 6F 6E 3D 61 74 74 61 63 68 6D 65 6E 74 25  |tion=attachment%|
000001C0  33 42 25 32 30 66 69 6C 65 6E 61 6D 65 25 33 44  |3B%20filename%3D|
000001D0  78 31 36 65 6D 75 5F 6D 61 63 2D 72 33 30 2E 7A  |x16emu_mac-r30.z|
000001E0  69 70 26 72 65 73 70 6F 6E 73 65 2D 63 6F 6E 74  |ip&response-cont|
000001F0  65 6E 74 2D 74 79 70 65 3D 61 70 70 6C 69 63 61  |ent-type=applica|
00000200  74 69 6F 6E 25 32 46 6F 63 74 65 74 2D 73 74 72  |tion%2Foctet-str|
00000210  65 61 6D 5F 10 35 68 74 74 70 73 3A 2F 2F 67 69  |eam_.5https://gi|
00000220  74 68 75 62 2E 63 6F 6D 2F 63 6F 6D 6D 61 6E 64  |thub.com/command|
00000230  65 72 78 31 36 2F 78 31 36 2D 65 6D 75 6C 61 74  |erx16/x16-emulat|
00000240  6F 72 2F 72 65 6C 65 61 73 65 73 00 08 00 0B 02  |or/releases.....|
00000250  13 00 00 00 00 00 00 02 01 00 00 00 00 00 00 00  |................|
00000260  03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02  |................|
00000270  4B                                               |K|
00000271
com.apple.quarantine: 0083;5d7ab89f;Safari;20D8169B-D093-4124-A2AF-A05A943AE5A2

For those unaware, files (or, in this case, metadata) that starts with bplist00 are binary Property Lists. So some processing will need to be done to turn a URL into a format that Apple expects for their metadata.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.