GithubHelp home page GithubHelp logo

datacoon / metawarc Goto Github PK

View Code? Open in Web Editor NEW
24.0 4.0 0.0 85 KB

metawarc: a command-line tool for metadata extraction from files from WARC (Web ARChive)

License: MIT License

Python 100.00%
warc warc-files webarchiving metadata osint osint-python

metawarc's People

Contributors

ivbeg avatar snyk-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

metawarc's Issues

Feature Request

I like both of the analyze and metadata commands, however in my agency we need a detailed file listing that includes things like file name, byte size, file extension, preferably in CSV output. I understand the need for JSON output for the detailed metadata, but is there a chance for a new switch that outputs detailed information as above in CSV format? Not including the repeating fields with extracted data for the specific file types.

Thanks!

Error with pip installed version

metawarc metadata flashfrozen-jwat-recompressed.warc.gz

2022-04-11 12:25:39,961 - root - DEBUG - Preparing flashfrozen-jwat-recompressed.warc.gz
[warn] Skip parser 'FAT12': stream is smaller than 512.0 bytes
[warn] Skip parser 'FAT16': stream is smaller than 512.0 bytes
[warn] Skip parser 'FAT32': stream is smaller than 512.0 bytes
[warn] Skip parser 'LinuxSwapFile': stream is smaller than 4096.0 bytes
[warn] Skip parser 'MSDos_HardDrive': stream is smaller than 512.0 bytes
[warn] Skip parser 'PIFVFile': Invalid magic number
[warn] Skip parser 'ElfFile': Invalid magic
[warn] Skip parser 'MachoFatFile': stream is smaller than 4180.0 bytes
[warn] Skip parser 'MachoFile': Invalid magic
[warn] Skip parser 'PRCFile': False
[warn] Skip parser 'FAT12': stream is smaller than 512.0 bytes
[warn] Skip parser 'FAT16': stream is smaller than 512.0 bytes
[warn] Skip parser 'FAT32': stream is smaller than 512.0 bytes
[warn] Skip parser 'LinuxSwapFile': stream is smaller than 4096.0 bytes
[warn] Skip parser 'MSDos_HardDrive': stream is smaller than 512.0 bytes
[warn] Skip parser 'PIFVFile': Invalid magic number
[warn] Skip parser 'ElfFile': Invalid magic
[warn] Skip parser 'MachoFatFile': stream is smaller than 4180.0 bytes
[warn] Skip parser 'MachoFile': Invalid magic
[warn] Skip parser 'PRCFile': False
[warn] Skip parser 'FAT12': Invalid FAT12 signature
[warn] Skip parser 'FAT16': Invalid FAT16 signature
[warn] Skip parser 'FAT32': Invalid FAT32 signature
[warn] Skip parser 'LinuxSwapFile': Unknown magic string
[warn] Skip parser 'MSDos_HardDrive': Invalid signature
[warn] Skip parser 'PIFVFile': Invalid magic number
[warn] Skip parser 'ElfFile': Invalid magic
[warn] Skip parser 'MachoFatFile': Invalid magic
[warn] Skip parser 'MachoFile': Invalid magic
[warn] Skip parser 'PRCFile': False
[warn] [] Error when getting size of 'header': delete it
[warn] Skip parser 'FAT12': Invalid FAT12 signature
[warn] Skip parser 'FAT16': Invalid FAT16 signature
[warn] Skip parser 'FAT32': Invalid FAT32 signature
[warn] Skip parser 'LinuxSwapFile': Unknown magic string
[warn] Skip parser 'MSDos_HardDrive': Invalid signature
[warn] Skip parser 'PIFVFile': Invalid magic number
[warn] Skip parser 'ElfFile': Invalid magic
[warn] Skip parser 'MachoFatFile': Invalid magic
[warn] Skip parser 'MachoFile': Invalid magic
[warn] Skip parser 'PRCFile': False
[warn] [] Error when getting size of 'header': delete it
[warn] Skip parser 'FAT12': Invalid FAT12 signature
[warn] Skip parser 'FAT16': Invalid FAT16 signature
[warn] Skip parser 'FAT32': Invalid FAT32 signature
[warn] Skip parser 'LinuxSwapFile': stream is smaller than 4096.0 bytes
[warn] Skip parser 'MSDos_HardDrive': Invalid signature
[warn] Skip parser 'PIFVFile': Invalid magic number
[warn] Skip parser 'ElfFile': Invalid magic
[warn] Skip parser 'MachoFatFile': stream is smaller than 4180.0 bytes
[warn] Skip parser 'MachoFile': Invalid magic
[warn] Skip parser 'PRCFile': False
[warn] [] Error when getting size of 'header': delete it
[warn] Skip parser 'FAT12': stream is smaller than 512.0 bytes
[warn] Skip parser 'FAT16': stream is smaller than 512.0 bytes
[warn] Skip parser 'FAT32': stream is smaller than 512.0 bytes
[warn] Skip parser 'LinuxSwapFile': stream is smaller than 4096.0 bytes
[warn] Skip parser 'MSDos_HardDrive': stream is smaller than 512.0 bytes
[warn] Skip parser 'PIFVFile': Invalid magic number
[warn] Skip parser 'ElfFile': Invalid magic
[warn] Skip parser 'MachoFatFile': stream is smaller than 4180.0 bytes
[warn] Skip parser 'MachoFile': Invalid magic
[warn] Skip parser 'PRCFile': False
[warn] [] Error when getting size of 'header': delete it
[warn] Skip parser 'FAT12': Invalid FAT12 signature
[warn] Skip parser 'FAT16': Invalid FAT16 signature
[warn] Skip parser 'FAT32': Invalid FAT32 signature
[warn] Skip parser 'LinuxSwapFile': Unknown magic string
[warn] Skip parser 'MSDos_HardDrive': Invalid signature
[warn] Skip parser 'PIFVFile': Invalid magic number
[warn] Skip parser 'ElfFile': Invalid magic
[warn] Skip parser 'MachoFatFile': Invalid magic
[warn] Skip parser 'MachoFile': Invalid magic
[warn] Skip parser 'PRCFile': False
[warn] [] Error when getting size of 'header': delete it
[warn] Skip parser 'FAT12': Invalid FAT12 signature
[warn] Skip parser 'FAT16': Invalid FAT16 signature
[warn] Skip parser 'FAT32': Invalid FAT32 signature
[warn] Skip parser 'LinuxSwapFile': Unknown magic string
[warn] Skip parser 'MSDos_HardDrive': Invalid signature
[warn] Skip parser 'PIFVFile': Invalid magic number
[warn] Skip parser 'ElfFile': Invalid magic
[warn] Skip parser 'MachoFatFile': Invalid magic
[warn] Skip parser 'MachoFile': Invalid magic
[warn] Skip parser 'PRCFile': False
[warn] [] Error when getting size of 'header': delete it
[warn] Skip parser 'FAT12': Invalid FAT12 signature
[warn] Skip parser 'FAT16': Invalid FAT16 signature
[warn] Skip parser 'FAT32': Invalid FAT32 signature
[warn] Skip parser 'LinuxSwapFile': Unknown magic string
[warn] Skip parser 'MSDos_HardDrive': Invalid signature
[warn] Skip parser 'PIFVFile': Invalid magic number
[warn] Skip parser 'ElfFile': Invalid magic
[warn] Skip parser 'MachoFatFile': Invalid magic
[warn] Skip parser 'MachoFile': Invalid magic
[warn] Skip parser 'PRCFile': False
[warn] [] Error when getting size of 'header': delete it
[warn] Skip parser 'FAT12': Invalid FAT12 signature
[warn] Skip parser 'FAT16': Invalid FAT16 signature
[warn] Skip parser 'FAT32': Invalid FAT32 signature
[warn] Skip parser 'LinuxSwapFile': Unknown magic string
[warn] Skip parser 'MSDos_HardDrive': Invalid signature
[warn] Skip parser 'PIFVFile': Invalid magic number
[warn] Skip parser 'ElfFile': Invalid magic
[warn] Skip parser 'MachoFatFile': Invalid magic
[warn] Skip parser 'MachoFile': Invalid magic
[warn] Skip parser 'PRCFile': False
[warn] [] Error when getting size of 'header': delete it
[warn] Skip parser 'FAT12': Invalid FAT12 signature
[warn] Skip parser 'FAT16': Invalid FAT16 signature
[warn] Skip parser 'FAT32': Invalid FAT32 signature
[warn] Skip parser 'LinuxSwapFile': stream is smaller than 4096.0 bytes
[warn] Skip parser 'MSDos_HardDrive': Invalid signature
[warn] Skip parser 'PIFVFile': Invalid magic number
[warn] Skip parser 'ElfFile': Invalid magic
[warn] Skip parser 'MachoFatFile': stream is smaller than 4180.0 bytes
[warn] Skip parser 'MachoFile': Invalid magic
[warn] Skip parser 'PRCFile': False
[warn] [] Error when getting size of 'header': delete it
[warn] Skip parser 'FAT12': Invalid FAT12 signature
[warn] Skip parser 'FAT16': Invalid FAT16 signature
[warn] Skip parser 'FAT32': Invalid FAT32 signature
[warn] Skip parser 'LinuxSwapFile': Unknown magic string
[warn] Skip parser 'MSDos_HardDrive': Invalid signature
[warn] Skip parser 'PIFVFile': Invalid magic number
[warn] Skip parser 'ElfFile': Invalid magic
[warn] Skip parser 'MachoFatFile': Invalid magic
[warn] Skip parser 'MachoFile': Invalid magic
[warn] Skip parser 'PRCFile': False
[warn] Skip parser 'FAT12': Invalid FAT12 signature
[warn] Skip parser 'FAT16': Invalid FAT16 signature
[warn] Skip parser 'FAT32': Invalid FAT32 signature
[warn] Skip parser 'LinuxSwapFile': Unknown magic string
[warn] Skip parser 'MSDos_HardDrive': Invalid signature
[warn] Skip parser 'PIFVFile': Invalid magic number
[warn] Skip parser 'ElfFile': Invalid magic
[warn] Skip parser 'MachoFatFile': Invalid magic
[warn] Skip parser 'MachoFile': Invalid magic
[warn] Skip parser 'PRCFile': False
[warn] [] Error when getting size of 'header': delete it
[warn] Skip value width_dpi=0 (filter)
[warn] Skip value height_dpi=0 (filter)
Traceback (most recent call last):
File "/home/lepore/anaconda3/bin/metawarc", line 8, in
sys.exit(main())
File "/home/lepore/anaconda3/lib/python3.9/site-packages/metawarc/main.py", line 11, in main
exit_status = cli()
File "/home/lepore/anaconda3/lib/python3.9/site-packages/click/core.py", line 1128, in call
return self.main(*args, **kwargs)
File "/home/lepore/anaconda3/lib/python3.9/site-packages/click/core.py", line 1053, in main
rv = self.invoke(ctx)
File "/home/lepore/anaconda3/lib/python3.9/site-packages/click/core.py", line 1659, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/lepore/anaconda3/lib/python3.9/site-packages/click/core.py", line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/lepore/anaconda3/lib/python3.9/site-packages/click/core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "/home/lepore/anaconda3/lib/python3.9/site-packages/metawarc/core.py", line 35, in metadata
acmd.metadata(input, filetypes.split(',') if filetypes else None, fields, output=output)
File "/home/lepore/anaconda3/lib/python3.9/site-packages/metawarc/cmds/extractor.py", line 137, in metadata
result = processWarcRecord(record, url, filename, mime=h)
File "/home/lepore/anaconda3/lib/python3.9/site-packages/metawarc/cmds/extractor.py", line 87, in processWarcRecord
parser = createParser(temp.name)
File "/home/lepore/anaconda3/lib/python3.9/site-packages/hachoir/parser/guess.py", line 136, in createParser
stream = FileInputStream(filename, real_filename, tags=tags)
File "/home/lepore/anaconda3/lib/python3.9/site-packages/hachoir/stream/input_helper.py", line 38, in FileInputStream
return InputIOStream(inputio, source=source, **args)
File "/home/lepore/anaconda3/lib/python3.9/site-packages/hachoir/stream/input.py", line 412, in init
InputStream.init(self, size=size, **args)
File "/home/lepore/anaconda3/lib/python3.9/site-packages/hachoir/stream/input.py", line 136, in init
raise NullStreamError(source)
hachoir.stream.input.NullStreamError: Input size is nul (source='file:/tmp/tmpqv9quokupng')!
lepore-desktop:~/Downloads/working/warc/webarchive-discovery/warc-indexer/src/test/resources/wikipedia-mona-lisa$

NameError: name 'unknown' is not defined

$ metawarc dump -e mp3,ogg -o audio
Wrote 790a1d27-01c8-460a-968b-d2c6cf22aa31.mp3, url https://cdn.echo.msk.ru/snd/2022-03-02-osoboe-1908-3631063.mp3
...
...
Wrote f9204bd8-c662-4cff-9261-df686e6383d6.mp3, url https://cdn.echo.msk.ru/snd/2021-10-25-personalnovash-1505-sd-3551552.mp3
Traceback (most recent call last):
File "/home/me/.local/bin/metawarc", line 8, in
sys.exit(main())
File "/home/me/.local/lib/python3.10/site-packages/metawarc/main.py", line 12, in main
exit_status = cli()
File "/usr/lib/python3.10/site-packages/click/core.py", line 1130, in call
return self.main(*args, **kwargs)
File "/usr/lib/python3.10/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/usr/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/lib/python3.10/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/home/me/.local/lib/python3.10/site-packages/metawarc/core.py", line 215, in dump
acmd.dump(mimes=mimes, exts=exts, query=query, output=output)
File "/home/me/.local/lib/python3.10/site-packages/metawarc/cmds/dump.py", line 140, in dump
filename = record.warc_id + '.' + get_ext_from_content_type(record.content_type)
File "/home/me/.local/lib/python3.10/site-packages/metawarc/cmds/dump.py", line 62, in get_ext_from_content_type
return unknown
NameError: name 'unknown' is not defined

In my WARC file (Плющев выкладывал ссылку в телеграм) exist 'audio/mp3'
I add 'audio/mp3' : 'mp3', in MIME_EXT_MAP and error is disappear
Thanks

example of "bad" record in db
INSERT INTO record VALUES(3483,'920138fa-d58c-4d15-b3bb-c8521c93199b','audio/mp3',200,'https://cdn.echo.msk.ru/snd/2009-03-06-
vlast-2000.mp3','2009-03-06-vlast-2000.mp3','mp3','echo.msk.ru.warc.gz',10075372887,13434884,13991489,'"{"Server": "nginx"
, "Date": "Thu, 03 Mar 2022 08:36:36 GMT", "Content-Type": "audio/mp3", "Content-Length": "13990981", "Connection
": "keep-alive", "Last-Modified": "Fri, 29 Oct 2021 19:44:09 GMT", "x-rgw-object-type": "Normal", "ETag": "\"5
dcebd6aca8b9f6b9579dacf4ccd03ce\"", "x-amz-request-id": "tx0000000000000106f1bbf-0061e352aa-3e13cf9-dt2", "Cache": "
MISS", "X-Cached-Since": "2022-01-15T23:03:06+00:00", "Access-Control-Allow-Origin": "*", "X-ID": "rtc-up-gc5",
"Accept-Ranges": "bytes", "X-SHARD": "rtc-shard0-default_443"}"');

Some errors

python metawarc metadata digital.gov.ru.warc.gz
Traceback (most recent call last):
File "/home/gitpod/.pyenv/versions/3.8.12/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/home/gitpod/.pyenv/versions/3.8.12/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/workspace/metawarc/metawarc/main.py", line 18, in
main()
File "/workspace/metawarc/metawarc/main.py", line 10, in main
from .core import cli
ImportError: attempted relative import with no known parent package

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.