diff options
author | Bryan Newbold <bnewbold@archive.org> | 2018-04-03 16:30:19 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@archive.org> | 2018-04-03 16:30:19 -0700 |
commit | 5ea0ef0fd34f09fab51f51e2f1dbe5cf6ec137cc (patch) | |
tree | 6198a1c156d6922c02f12964d5e9a30d71677dcc | |
parent | f10e8b798c8611d316279aa0afb158ee14691236 (diff) | |
download | sandcrawler-5ea0ef0fd34f09fab51f51e2f1dbe5cf6ec137cc.tar.gz sandcrawler-5ea0ef0fd34f09fab51f51e2f1dbe5cf6ec137cc.zip |
WIP on extractor-with-mrjob
-rw-r--r-- | extraction/Pipfile | 25 | ||||
-rw-r--r-- | extraction/Pipfile.lock | 858 | ||||
-rw-r--r-- | extraction/README.md | 19 | ||||
-rw-r--r-- | extraction/extraction.py | 52 |
4 files changed, 954 insertions, 0 deletions
diff --git a/extraction/Pipfile b/extraction/Pipfile new file mode 100644 index 0000000..600916c --- /dev/null +++ b/extraction/Pipfile @@ -0,0 +1,25 @@ +[[source]] +name = "ia" +url = "https://devpi.archive.org/wb/prod" +verify_ssl = true + +[[source]] +name = "pypi" +url = "https://pypi.python.org/simple" +verify_ssl = true + +[dev-packages] + +[packages] +pytest = "*" +mrjob = "*" +requests = "*" +wayback = {version=">=0.2.1.2", index="ia"} +globalwayback = {version=">=0.3", index="ia"} +pytest-pythonpath = "*" +happybase = "*" +happybase-mock = "*" +xmltodict = "*" + +[requires] +python_version = "3.5" diff --git a/extraction/Pipfile.lock b/extraction/Pipfile.lock new file mode 100644 index 0000000..329bea7 --- /dev/null +++ b/extraction/Pipfile.lock @@ -0,0 +1,858 @@ +{ + "_meta": { + "hash": { + "sha256": "747bf23090f964936df46efa5e2b79e456dd562beecf372290ff2b90326a57c5" + }, + "pipfile-spec": 6, + "requires": { + "python_version": "3.5" + }, + "sources": [ + { + "name": "ia", + "url": "https://devpi.archive.org/wb/prod", + "verify_ssl": true + }, + { + "name": "pypi", + "url": "https://pypi.python.org/simple", + "verify_ssl": true + } + ] + }, + "default": { + "attrs": { + "hashes": [ + "sha256:1c7960ccfd6a005cd9f7ba884e6316b5e430a3f1a6c37c5f87d8b43f83b54ec9", + "sha256:a17a9573a6f475c99b551c0e0a812707ddda1ec9653bed04c13841404ed6f450" + ], + "version": "==17.4.0" + }, + "boto3": { + "hashes": [ + "sha256:926910b77d5f8037527ff81a91b92e7a9100685b297e3ebd12dd584e5b0386bb", + "sha256:9713d381409c5abbff8d8f2c9ebf9713e5aeb6cd12bd16503d61978dbd4f77a6" + ], + "version": "==1.6.21" + }, + "botocore": { + "hashes": [ + "sha256:039b768f5d248e13c1fb4be739523d7d1d75133a563dd212e932f3fc973bffb9", + "sha256:c954af8b33232f25df496c9e7e5f6dbcef081ef7163eadfc22a4bd9ce69dcc56" + ], + "version": "==1.9.21" + }, + "cachetools": { + "hashes": [ + "sha256:4319bbb78172e7bcf99423e1ecd6914b32336ccfe97d2058ffe62e641a7f3abe", + "sha256:ede01f2d3cbd6ddc9e35e16c2b0ce011d8bb70ce0dbaf282f5b4df24b213bc5d" + ], + "version": "==2.0.1" + }, + "certifi": { + "hashes": [ + "sha256:14131608ad2fd56836d33a71ee60fa1c82bc9d2c8d98b7bdbc631fe1b3cd1296", + "sha256:edbc3f203427eef571f79a7692bb160a2b0f7ccaa31953e99bd17e307cf63f7d" + ], + "version": "==2018.1.18" + }, + "chardet": { + "hashes": [ + "sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae", + "sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691" + ], + "version": "==3.0.4" + }, + "click": { + "hashes": [ + "sha256:29f99fc6125fbc931b758dc053b3114e55c77a6e4c6c3a2674a2dc986016381d", + "sha256:f15516df478d5a56180fbf80e68f206010e6d160fc39fa508b65e035fd75130b" + ], + "version": "==6.7" + }, + "crawllib": { + "hashes": [ + "sha256:e24fa61cab91e0e7f461ff6173c2395fede3d4fbab565704622f5252028bdef3" + ], + "version": "==0.1.4" + }, + "dawg": { + "hashes": [ + "sha256:111aec946fc6045776e8a977f8be841b099769f3c8ab041dba4773ffeda21ad5", + "sha256:30d5da3e48b8cbe5ec94c5a202d2962780d3895ba0883123e6788565f71b2953", + "sha256:3a5ea13d5a424542d1a7fa908db974e712be90ccdd86cec9e24c6b20794f5f5e", + "sha256:402659e3044a5fb79dadefeaabb15ba9c0ef56c844bb4bcde6b102afbf4788f8", + "sha256:7accbfe484a353e1f02a947f84f817846f30738d1170d4e855f536d5708632a3", + "sha256:9c7321d4f2a580506e06c29ed276ae50df9eb153470e8e980e79409e12b18e55", + "sha256:ad0fdd2f6ed0a0155f00e7f61f3649898dabf7e344eb87732b34414f34cc31d9", + "sha256:b1f9c72bb3eca530f78fcf82f2d60ff41298f10e1c9f018b402af0ecbe246171" + ], + "version": "==0.7.8" + }, + "dill": { + "hashes": [ + "sha256:97fd758f5fe742d42b11ec8318ecfcff8776bccacbfcec05dfd6276f5d450f73" + ], + "version": "==0.2.7.1" + }, + "docutils": { + "hashes": [ + "sha256:02aec4bd92ab067f6ff27a38a38a41173bf01bed8f89157768c1573f53e474a6", + "sha256:51e64ef2ebfb29cae1faa133b3710143496eca21c530f3f71424d77687764274", + "sha256:7a4bd47eaf6596e1295ecb11361139febe29b084a87bf005bf899f9a42edc3c6" + ], + "version": "==0.14" + }, + "dogpile.cache": { + "hashes": [ + "sha256:631197e78b4471bb0e93d0a86264c45736bc9ae43b4205d581dcc34fbe9b5f31" + ], + "version": "==0.6.5" + }, + "elasticsearch": { + "hashes": [ + "sha256:2e6dcdf9cb62377e0d6b82d2931ebc67b5a549081bbb531aa3be60ece33257b2", + "sha256:8539e30c33fa0ad09617893a458056a35a654c92226390c30a07a3776bb8a94f" + ], + "version": "==5.5.2" + }, + "flask": { + "hashes": [ + "sha256:0749df235e3ff61ac108f69ac178c9770caeaccad2509cb762ce1f65570a8856", + "sha256:49f44461237b69ecd901cc7ce66feea0319b9158743dd27a2899962ab214dac1" + ], + "version": "==0.12.2" + }, + "future": { + "hashes": [ + "sha256:e39ced1ab767b5936646cedba8bcce582398233d6a627067d4c6a454c90cfedb" + ], + "version": "==0.16.0" + }, + "gapic-google-cloud-datastore-v1": { + "hashes": [ + "sha256:d5d0e6f7b4996a8dd5f4f5ad27cd389a5d7bedd07e6e9b9f3a4a3c3ea56d9053" + ], + "version": "==0.15.3" + }, + "gapic-google-cloud-error-reporting-v1beta1": { + "hashes": [ + "sha256:39f3f8e974441fb57ea98d0be0f4cdedd18cda9a628aec31e1f0841affab6f16" + ], + "version": "==0.15.3" + }, + "gapic-google-cloud-logging-v2": { + "hashes": [ + "sha256:b0b87bf56c50e4617fb539e5c36f2e286ba87c67a9b1ef5c9ec854d6d7b10023" + ], + "version": "==0.91.3" + }, + "globalwayback": { + "hashes": [ + "sha256:74fb668e94528228d30040654fb5cc1cb7978da3982fa7e4e6bc36bafa4685be" + ], + "index": "ia", + "version": "==0.3.10.9" + }, + "google-api-core": { + "hashes": [ + "sha256:0144d467083ed54d2e8ccb4212d42c3724fe0b844b7d3a0ff85aea54b7ae8347", + "sha256:1698e4af4edd2a8ec22d678fd9abe99c926c3a154b2232f32807946ca49e3da1" + ], + "version": "==0.1.4" + }, + "google-auth": { + "hashes": [ + "sha256:34088434cb2a2409360b8f3cbc04195a465df1fb2aafad71ebbded77cbf08803", + "sha256:9051802d3dae256036cca9e34633a32c0ed1427730d4ebc513dff91ec8b6dd45" + ], + "version": "==1.4.1" + }, + "google-cloud": { + "hashes": [ + "sha256:21a11ad63cc29cfd4e4b6426947bdc2cbefe080f87ad68fa432cf2ac108cb87d", + "sha256:a99ee610e058c2af84ca1da710afe80fca022d2572c4bce78f6fdecac6b32d07" + ], + "version": "==0.32.0" + }, + "google-cloud-bigquery": { + "hashes": [ + "sha256:1c5a42332b43b58d6039fbca697a88c230487212afb6b4a6cbe0d5f3d5685785", + "sha256:511f27e5e398f8bb4dcad914596e32fe5bcb111257f032d93956a2dcced4a00f" + ], + "version": "==0.28.0" + }, + "google-cloud-bigquery-datatransfer": { + "hashes": [ + "sha256:c0a290f9456b52c633cf966c73311038eb2d3fd5a61b40059edad966a434e4f9", + "sha256:f5b5d0de43805fa9ebb620c58e1d27e6d32d2fc8e9a2f954ee170f7a026c8757" + ], + "version": "==0.1.1" + }, + "google-cloud-bigtable": { + "hashes": [ + "sha256:22c7148dc339be791d2bf4616c87e523507618570356148375c631de412f551b", + "sha256:7f86d2c8d7f22670da98fd67bcdc17cab793f7400725c8148b05ad829c02b95e" + ], + "version": "==0.28.1" + }, + "google-cloud-container": { + "hashes": [ + "sha256:275de3032de5696cd976459966e911abd3a1b624c7a918a8137a0308898e4f90", + "sha256:a89afcb1fe96bc9361c231c223c3bbe19fa3787caeb4697cd5778990e1077270" + ], + "version": "==0.1.1" + }, + "google-cloud-core": { + "hashes": [ + "sha256:0090df83dbc5cb2405fa90844366d13176d1c0b48181c1807ab15f53be403f73", + "sha256:89e8140a288acec20c5e56159461d3afa4073570c9758c05d4e6cb7f2f8cc440" + ], + "version": "==0.28.1" + }, + "google-cloud-dataproc": { + "hashes": [ + "sha256:1096534affe51b2e54b7c57f429b83c4566f92ed42fdee6613a001649c61c3d5", + "sha256:8537b0de721ec4524cb580572f44f88d2b22a1f5c56968448003ca9023ecb951" + ], + "version": "==0.1.0" + }, + "google-cloud-datastore": { + "hashes": [ + "sha256:3094b38df19a0a6663b614122d97efcfeab35baf770070e960f6792522307997", + "sha256:7cc7a48945dd0ec8aea2d8a169f8a3dfd84608392b00b514b4421b5a716b3263" + ], + "version": "==1.4.0" + }, + "google-cloud-dns": { + "hashes": [ + "sha256:2edcb33ea0025545746962839373ff6d314a5fac779fd7f7ddd0e592196fbb14", + "sha256:5db79c21a2ee72854609db88d5a4ae897c32bf77bf6b51b3290e013b2db49e07" + ], + "version": "==0.28.0" + }, + "google-cloud-error-reporting": { + "hashes": [ + "sha256:6398c5963599f834d2ba2effbca4f67dbd21034252d33d0f367d1a7c868cfb98", + "sha256:d4bdc20b5704afddc12a464622153c250be62a9d38a57d0f9371a0a3f3e43c71" + ], + "version": "==0.28.0" + }, + "google-cloud-firestore": { + "hashes": [ + "sha256:91b1373faf1c763ce9cda915a82655918035e4d09e8d2399170122f94274c977", + "sha256:c12fe5a017a56c8d617bdf83ace3970afba886c09fc0d6c0d24f36f8644dc178" + ], + "version": "==0.28.0" + }, + "google-cloud-language": { + "hashes": [ + "sha256:59e7c3ed0dcf54d17943cad29ececb41adbbfc1b56c9ba278c13fd17aea54188", + "sha256:b5c3073697b9c51b8f1a4a619f7b3b6744e88efe0e235958ff411ee17e825c61" + ], + "version": "==1.0.1" + }, + "google-cloud-logging": { + "hashes": [ + "sha256:81ff672f3b4c6f2a182282aae68f7c3dafbbfc8dc7dcc0db8dc90cd288adc3b8", + "sha256:a1567aa858fbe223973c698f12198e5828fa66f3d42dac27e81b246ff385cd70" + ], + "version": "==1.4.0" + }, + "google-cloud-monitoring": { + "hashes": [ + "sha256:534d66d97611c9c6e08823532f5144f6786d3a6103a6d5ed6411ac465faa5341", + "sha256:c7a336a469cf186e3621fe36bf0e4f291ea43a76b4a532b744a167d756a8170d" + ], + "version": "==0.28.1" + }, + "google-cloud-pubsub": { + "hashes": [ + "sha256:059dcd1862e07a47920474b0fe38d40508d8c4881929f17696a3aba834b11027", + "sha256:ff6e74390dfa097e3cee7d5f323aeed37a23dfb1faa762d9efced09f972415a4" + ], + "version": "==0.30.1" + }, + "google-cloud-resource-manager": { + "hashes": [ + "sha256:ed4eaab40164614db77496986fb2900d93cb1daa7e1a23fd20be7bd46705a8f3", + "sha256:fc29c11dcbe9208261d377185a1ae5331bab43f2a592222a25c8aca9c8031308" + ], + "version": "==0.28.1" + }, + "google-cloud-runtimeconfig": { + "hashes": [ + "sha256:095a1dab0d7b8e02dff06bee7844bb283a1c2c6f2e7333eb9896419a30143d82", + "sha256:f441fbc22e2d0871ecb390854aa352cf467d2751cbc0dac7578274ead813519e" + ], + "version": "==0.28.1" + }, + "google-cloud-spanner": { + "hashes": [ + "sha256:39707e37e2399df0a6ea7f5b636fc06858359a70af92ac485bbba9bf810a43e7", + "sha256:bc4c6269b07d0982289d4ecd9b88da943e097ab2104c79ce18e4966766bb877b" + ], + "version": "==0.29.0" + }, + "google-cloud-speech": { + "hashes": [ + "sha256:76e42ffdea4bb9790cac34d5a4cdb2e2d47a0e254a27dbbaf40fbd10fdb04e31", + "sha256:ea920710b2fa74175bacc1f90a2eb326038eeaf3ce364c29a40e7eb70c7c7132" + ], + "version": "==0.30.0" + }, + "google-cloud-storage": { + "hashes": [ + "sha256:5db85fa905f85377c5ea9ea0fb4c5602343d2ecc09395aa2efbf9a21d27233fc", + "sha256:939266b7d5c6df6d45a1aee2c47a09313f813e87790335f00c57708b49480054" + ], + "version": "==1.6.0" + }, + "google-cloud-trace": { + "hashes": [ + "sha256:b45bc7934ee459e83f1a4b04ba7a0de1be9fe004bcf494b9ff2f75e18414642c", + "sha256:c926f55c141caf9fd0e29991caaba03a6364fe997384e2f48c34051f0f690186" + ], + "version": "==0.17.0" + }, + "google-cloud-translate": { + "hashes": [ + "sha256:4420f5b320145bf097ca9a12b18ec27c067886e2832d181f268c46c3bcb0d2e4", + "sha256:7706814d8ee1be9668b5c204852d44e7f6c51d44a2822df772b7b2fa3fb7c6bb" + ], + "version": "==1.3.1" + }, + "google-cloud-videointelligence": { + "hashes": [ + "sha256:5c18e64bf41fc5f8203d3b4f7a88921ff8d6a09b8ce343da866274fa375dcb82", + "sha256:d46b94f8d37da565a90fb282a4053ee1379b4cbe1e2b51dfef75444fd5422e5d" + ], + "version": "==1.0.1" + }, + "google-cloud-vision": { + "hashes": [ + "sha256:9442d3456935654920f002efa846271dc68b19f5a0b3e2c314a9edd9f34f30a3", + "sha256:a4cd3f64ac2c2586a56ea00d27c58306465e3277873cc9bfce3677e9ccb2b039" + ], + "version": "==0.29.0" + }, + "google-gax": { + "hashes": [ + "sha256:518e8d5eb90774af2041080d242f4bcec4c6e653226c693901eaf82eda8a395c", + "sha256:bc60cdfed5c657ea8542ba8102fb43862a1c4809d98ca5aa1fcc92f9d4f7403d" + ], + "version": "==0.15.16" + }, + "google-resumable-media": { + "hashes": [ + "sha256:116de90b9cd483b17c53618ee6a5a20f33e741c648140c8cc9c2141e07616ff1", + "sha256:97de518f8166d442cc0b61fab308bcd319dbb970981e667ec8ded44f5ce49836" + ], + "version": "==0.3.1" + }, + "googleapis-common-protos": { + "hashes": [ + "sha256:c075eddaa2628ab519e01b7d75b76e66c40eaa50fc52758d8225f84708950ef2" + ], + "version": "==1.5.3" + }, + "grpc-google-iam-v1": { + "hashes": [ + "sha256:5009e831dcec22f3ff00e89405249d6a838d1449a46ac8224907aa5b0e0b1aec" + ], + "version": "==0.11.4" + }, + "grpcio": { + "hashes": [ + "sha256:022dc2a6d1537a5a16af4ccc3355ad7b512f9c627a1d5d579cd7c18830378bb3", + "sha256:025a591606b0aca13bec3e019d6acec01a39421f01b915b98a3a93ea0a53b412", + "sha256:03265472d39bf26f124c3ef68446f7873c8260893e6ae65b323a5b51ed52e580", + "sha256:10efe2e016c3ca7a370771ffcf1de9baa3456d4bccefde0f4ce3be091d871c8f", + "sha256:14bca481188c3f19135012aaff9abefa4e15529c7e1aca3084183d78094d06bd", + "sha256:17240d672b5c1c9ff22e52236c1870413b7fb5af762b97ce5a747a55e0a57e98", + "sha256:1bc36e512741f82c1d73f42df536aa2ab75d840f0d35c149b5d0bee1aed16862", + "sha256:224c513fbe0c3ca546870e5c21b08a8a56cd25795b76b3192ee9702a3344764b", + "sha256:2894466c499d9752e0d49ee8adc5ee12c676d86211fc1b292bf713cc7cfe9853", + "sha256:435b3bab2e34814666854eec203c77b169df1cd56cf22fe449cf5510af416e7d", + "sha256:4765600467d7cdb8f62a591d4427ddbeefcf4dbbe46e2f1b10af555e815ecbcb", + "sha256:4fa658a7e1ba5727ca066b1c8bb64c6befb98f2b8007f04a16c7c84555bf11b9", + "sha256:87e52924a99ac5935a468b3fe49c4b0090bd9b05470b55ed1192308791e6d332", + "sha256:88afda198adb0a9da52a66152062027a57877b46f59ffcf55acc3cbfaff77160", + "sha256:982439a872d41f969724efc139e0416ba45e0d7446e9a41fd2ebe19351adff9a", + "sha256:a1bc37c9910d0fbf4d9e80d5822f92c6e01e28dd1eb01323636ed19666b537cb", + "sha256:aa473b8276de39eeccc4ad6cbb7fd7feab0868180d72c0c93226033c79fa69b7", + "sha256:ae82bf2f7ceac6ba956e816120b4f66bda035571350e46b61bbdde1808aed1dd", + "sha256:b56e4f355c2499bb0bf8f8f4d0362b618b06afdfd2c10722710596dc7e295c6c", + "sha256:d2accc8e354f0ed5b337865260a78b3c6851d2fe3c0e1b025d437122cc15dd31", + "sha256:d410835e7554d064c2d99cfa0dd393ffbb0ccf52145ab51c725a8472ed254a3c", + "sha256:d9e3105f6de6cb759b028702bdd21cb36d27e010227669e43c675b9957a3c180", + "sha256:da306c80d69801a3e4115c448ed4ad481957d723ec1e00b99497c6661573c3e5", + "sha256:e579e4124d2a0931ce39639c60e0711918d6659b933eb97e67f60f84666ea488", + "sha256:e86639989c03831912fd9924beda26f6e9ffcc267656cea035bde9d88cf793b2", + "sha256:ea9564f58144e2f07995d57fb8e636be5efb084cd59c8651391ada2bb75dc0ff", + "sha256:f4a38071dd27f140cfe774f56aecdf0e33de926c21289cc9c7521ce8dd91fc1c" + ], + "version": "==1.10.0" + }, + "happybase": { + "hashes": [ + "sha256:e20376e2e32291798d2226502994134c1c4e175136d8375b3c517a234fa22481" + ], + "index": "ia", + "version": "==1.1.0" + }, + "happybase-mock": { + "hashes": [ + "sha256:327203ff63171a83c9fab34b249636b6a55550041273d2acddc0723433bdf260", + "sha256:bd4583551f40e8b7f622ffd462f8e7ed1d34d14d73fa1758f0a5f413b1949f50" + ], + "index": "ia", + "version": "==0.9.0" + }, + "httplib2": { + "hashes": [ + "sha256:e71daed9a0e6373642db61166fa70beecc9bf04383477f84671348c02a04cbdf" + ], + "version": "==0.11.3" + }, + "ialib": { + "hashes": [ + "sha256:6ec318ec7ce6aeb326984bb259dcbe0c0907e648b41ad6c0bba1a7c6eb285ef2" + ], + "version": "==0.1.1" + }, + "idna": { + "hashes": [ + "sha256:2c6a5de3089009e3da7c5dde64a141dbc8551d5b7f6cf4ed7c2568d0cc520a8f", + "sha256:8c7309c718f94b3a625cb648ace320157ad16ff131ae0af362c9f21b80ef6ec4" + ], + "version": "==2.6" + }, + "itsdangerous": { + "hashes": [ + "sha256:cbb3fcf8d3e33df861709ecaf89d9e6629cff0a217bc2848f1b41cd30d360519" + ], + "version": "==0.24" + }, + "jinja2": { + "hashes": [ + "sha256:74c935a1b8bb9a3947c50a54766a969d4846290e1e788ea44c1392163723c3bd", + "sha256:f84be1bb0040caca4cea721fcbbbbd61f9be9464ca236387158b0feea01914a4" + ], + "version": "==2.10" + }, + "jmespath": { + "hashes": [ + "sha256:6a81d4c9aa62caf061cb517b4d9ad1dd300374cd4706997aff9cd6aedd61fc64", + "sha256:f11b4461f425740a1d908e9a3f7365c3d2e569f6ca68a2ff8bc5bcd9676edd63" + ], + "version": "==0.9.3" + }, + "markupsafe": { + "hashes": [ + "sha256:a6be69091dac236ea9c6bc7d012beab42010fa914c459791d627dad4910eb665" + ], + "version": "==1.0" + }, + "more-itertools": { + "hashes": [ + "sha256:0dd8f72eeab0d2c3bd489025bb2f6a1b8342f9b198f6fc37b52d15cfa4531fea", + "sha256:11a625025954c20145b37ff6309cd54e39ca94f72f6bb9576d1195db6fa2442e", + "sha256:c9ce7eccdcb901a2c75d326ea134e0886abfbea5f93e91cc95de9507c0816c44" + ], + "version": "==4.1.0" + }, + "mrjob": { + "hashes": [ + "sha256:669a98afe53f4e4ad9373445f91a8c26e86e30f1acc50c7fd274a42e1ea846d8", + "sha256:6ec1aca9b376c98249a324dd7837cc76e676d48ba10b2b6cbef246eba0ee52e9" + ], + "index": "ia", + "version": "==0.6.2" + }, + "oauth2client": { + "hashes": [ + "sha256:5b5b056ec6f2304e7920b632885bd157fa71d1a7f3ddd00a43b1541a8d1a2460" + ], + "version": "==3.0.0" + }, + "pillow": { + "hashes": [ + "sha256:02d2ae1d7c311e6fa038abda0843683ae652c9292d723270c85deeb04a1001a8", + "sha256:1263e38b91ca0132c77d5ae5a4d396bce7e7b1d13427b5d2982ac8f5bfbef62b", + "sha256:1937c9e17f685fe6c360dd96ddb8f93f159ac721939ccbfc91a62d8124a29945", + "sha256:1ce73edaeb49af9ebeacfb8c58428ae39592839d3a7a16ef3926773f1c8ff8ee", + "sha256:2052f0372123c98497ee3294f4e20347d87b9f70d9c65ce2fc520b9339aa8465", + "sha256:2602c7152e26f5bece294edb97af40345409ae55f8ad2a6d5da4380f4178defe", + "sha256:26b4a2bcdf0e674505fcd2f1a882f29a99339ac3b5a8e7997b90ede2995434e2", + "sha256:282e069f92e43047b34bbd995a8800669af11d038db571758708ebcd96462964", + "sha256:2ee30463cbc8e60cba92722a3a64881a0d3df534a047e299a9bcf62ea34fd061", + "sha256:3183b19cdd6fb5c68498334601eba770bc7abd44977b4119e4fa49d45e12845b", + "sha256:3c6133d928643167af35a1dd012889e6ff2e407895d7e16c2425cdab1ab1d608", + "sha256:412f4999794a80c9153cd2156f040b8e570b145d2edf5830854578ffb0b27cac", + "sha256:4678857a6dd0834a77ad6b5eb75a6d79753aa1a13f54f1c47fdb1e9bca63f389", + "sha256:4756b77682c7335751a2cfc0e9e6d96945d88ffd315420d9010235021ddfc64c", + "sha256:486f4ccddee09429cb1c63ea56c02894aecf9d69acdcaf006c53835df2549fff", + "sha256:502275e7a83872e62e0cd0be4da575a53a1f9703341aba814527dacdda3660a8", + "sha256:5bcea0df97fe0b911a6629aab0997b98e8811561c27167266758a7ede173123e", + "sha256:61cb7e1ff212293d74155397fad008b052bc9633efdf9caa4271c316cd25b99f", + "sha256:68e45ed91531d3b05a17a356fd4cb928603a00259916e057730a024b029d6b51", + "sha256:69c3cc797a66241ed2fa61ff6f52c73e7bd3e738d80d64abb3500e6fbdec30a3", + "sha256:69ec2f0effe8b395e55929bb4d9a3ca8ff0c40f85d61d00e1e5b1e504d28b5e2", + "sha256:6a06f165dcec5789fd98a5d4fe542619ffd3b86b9bf616d1a54d824e9428c6d3", + "sha256:77eac8ee2b400be84618ab5876b0e59fe98e32fc4d99aaa34bf413e125361a05", + "sha256:82351254350d9212bccf71d387efae8ad8f6f4b904d095546a77852a6b16e05b", + "sha256:95236f64904157256254b6cc8e29feecd9ee6985732dcb36c9f58d7dabe081d0", + "sha256:95bd8811ad4ece9df7b8cb9a1eef6184b80b6b8b8c199751ab0a5fb48ae82f64", + "sha256:9992d8f4b4ad53467ea76e6b796c18e22ec948dcee064be07fb43c155472e1d7", + "sha256:9e274583a0eab0b6d227139146e28f74488cfbc0d262c4ba2e5c0998b9c498d2", + "sha256:a0b7eeee0346ca67cdd9b23a613de3fe71a4c46419c37bdfef69b82dd32a9a0a", + "sha256:a10befeb7b9975d7c3d2ca3eaf0cb505db98fe50874130e182c2a6f7a606591f", + "sha256:a47f8b12541ffc219a0f26030daee2a57d1251cfd76a9101cbea74674909d5a3", + "sha256:b55f62882d8db466fcf2228422bf3147617744888bf0cf6dffb3254a52eb316b", + "sha256:bf83901c158ad92e77e990f51531434e5a96c6aef805a84b6e3bfe825f4d4d0c", + "sha256:c32f99a0c7c5313b2df78399ef908563b319de23bec0cc89f1d04c37be19eb2d", + "sha256:c34d10dda36d64cecf78bc4689758eca1e79b1e88f6e1d8c7cf207e6b9e7c984", + "sha256:cf4b3c634b317ee247c3add4375b0a6bdc45eb0c12a5d7fbf9bfd47ec10b020f", + "sha256:d7cf28e14b55e2f8848fb5e37655ffe13a0d5846cccc6ba46e031d0cf21879a3", + "sha256:ddef2a522ba13348ecec354d6c4d2e24bd68fba2605d7c32682bc0140d9c4e9c", + "sha256:e04df3808d6202dd552c837c824796899c09ff0ff9c335607904e31f9d387110", + "sha256:e496387e51fec8d8b98312be0d4332dcffecbd60b42ddfa834baaea62cbddfcb", + "sha256:e784b1a9fc54ae88a7171aef60a38c2ec0dc463f066691765d11748e014ce2a0", + "sha256:eae3711a7916eb5ec800dfb6963da09db0ada63c0481639dd0ddc0b505883a02", + "sha256:f040b4709cba8922f60de441684b3d061fedb61c6ca50d231df8a4d55e45943c", + "sha256:f336019509df1a042b7d6bed69a0cb6c52108b6327ce936c2870145dc18f1394" + ], + "version": "==3.1.1" + }, + "pluggy": { + "hashes": [ + "sha256:7f8ae7f5bdf75671a718d2daf0a64b7885f74510bcd98b1a0bb420eb9a9d0cff" + ], + "version": "==0.6.0" + }, + "ply": { + "hashes": [ + "sha256:e7d1bdff026beb159c9942f7a17e102c375638d9478a7ecd4cc0c76afd8de0b8" + ], + "version": "==3.8" + }, + "proto-google-cloud-datastore-v1": { + "hashes": [ + "sha256:a431bb6a286107900c9ce3c48d316378867293c50a4d8a6c7393264600e916f9" + ], + "version": "==0.90.4" + }, + "proto-google-cloud-error-reporting-v1beta1": { + "hashes": [ + "sha256:526f49ae84dec16aa4740415c86a919d48206001d116d12df5badc5b2b051b82" + ], + "version": "==0.15.3" + }, + "proto-google-cloud-logging-v2": { + "hashes": [ + "sha256:e0538745f0f33760ffd5116f33385113835a3b2042a6c914923be0539e5280ce" + ], + "version": "==0.91.3" + }, + "protobuf": { + "hashes": [ + "sha256:01ccd6d03449ae75b779fb5bf4ed62177d61afe3c5e6465ccf3f8b2e1a84afbe", + "sha256:1d92cc30b0b46cced33adde5853d920179eb5ea8eecdee9552502a7f29cc3f21", + "sha256:242e4c7ae565267a8bc8b92d707177f915607ea4bd73244bec6cbf4a49b96661", + "sha256:3b60685732bd0cbdc802dfcb6071efbcf5d927ce3127c13c33ea1a8efae3aa76", + "sha256:3f655e1f99c3e14d56ca900af1b9a4715b691319a295cc38939d7f77eabd5e7c", + "sha256:560a38e692a69957a70ba0e5839aa67430efd63072bf91b0539dac19055694cd", + "sha256:5c1c8f6a0a68a874e3beff89255959dd80fad45870e96c88944a1b81a22dd5f5", + "sha256:628a3bf0794a8b3cabb18db11eb67cc10e0cc6e5525d557ae7b682bb73fa2018", + "sha256:7222d6616108b33ad6cbeff8117062a73c43cdc8fa8f64f6a322ebeb663e710e", + "sha256:76ef6ca3c50e4cfd044861586d5f1b352e0fe7f17f883df6c165bad5b4d0e10a", + "sha256:7c193e6964e752bd056735594826c5b03274ceb8f07349d3ae47d9766250ba96", + "sha256:869e12bcfb5759e683f53ec1dd6155b7be034065431da289f0cb4510040a0799", + "sha256:905414e5ea6cdb78d8730f66335755152b46685fcb9fc2f2134024e3ea9e8dcc", + "sha256:ac0067e3c60737865ed72bb7416e02297d229d960902802d874c0e167128c809", + "sha256:adf716a89c9cc1891ead79a861c427071ef59172f0e11967b00565a9547b3bd0", + "sha256:bcfa99f5a82f5eaaf6e5cee5bfdca5a1670f5740aec1d93dae170645ed1a16b0", + "sha256:cc94079ae6cbcea5ae194464a30f3223f075e06a0446f52bca9ddbeb6e9f412a", + "sha256:d5d9edfdc5a3a01d06062d677b121081629782edf0e05ca1be14f15bb947eeee", + "sha256:e269ab7a50bf0fa6fe6a88ea7dcc7a1079ae9450d9ab9b7730ac32916d55508b", + "sha256:e7fd33a3474cbe18fd5b5620784a0fa21fcae3e402b1806e29c6b450c7f61706" + ], + "version": "==3.5.2.post1" + }, + "psutil": { + "hashes": [ + "sha256:230eeb3aeb077814f3a2cd036ddb6e0f571960d327298cc914c02385c3e02a63", + "sha256:4152ae231709e3e8b80e26b6da20dc965a1a589959c48af1ed024eca6473f60d", + "sha256:779ec7e7621758ca11a8d99a1064996454b3570154277cc21342a01148a49c28", + "sha256:82a06785db8eeb637b349006cc28a92e40cd190fefae9875246d18d0de7ccac8", + "sha256:8a15d773203a1277e57b1d11a7ccdf70804744ef4a9518a87ab8436995c31a4b", + "sha256:94d4e63189f2593960e73acaaf96be235dd8a455fe2bcb37d8ad6f0e87f61556", + "sha256:a3286556d4d2f341108db65d8e20d0cd3fcb9a91741cb5eb496832d7daf2a97c", + "sha256:c91eee73eea00df5e62c741b380b7e5b6fdd553891bee5669817a3a38d036f13", + "sha256:e2467e9312c2fa191687b89ff4bc2ad8843be4af6fb4dc95a7cc5f7d7a327b18" + ], + "version": "==5.4.3" + }, + "publicsuffix": { + "hashes": [ + "sha256:99a3a06d6eb19c57057d17560908b757995396ad76e6513c9d17e6a7a1266c91", + "sha256:ae77593d269e1e5131723259cc1142c25690c20c59f2e98f67e227228028bda9" + ], + "version": "==1.1.0" + }, + "py": { + "hashes": [ + "sha256:29c9fab495d7528e80ba1e343b958684f4ace687327e6f789a94bf3d1915f881", + "sha256:983f77f3331356039fdd792e9220b7b8ee1aa6bd2b25f567a963ff1de5a64f6a" + ], + "version": "==1.5.3" + }, + "pyasn1": { + "hashes": [ + "sha256:0d7f6e959fe53f3960a23d73f35e1fce61348b30915b6664309ca756de7c1f89", + "sha256:5a0db897b311d265cde49615cf783f1c78613138605cdd0f907ecfa5b2aba3ee", + "sha256:758cb50abddc03e4563fd9e7f03db56e3e87b58c0bd01247360326e5c0c7ffa5", + "sha256:7d626683e3d792cccc608da02498aff37ab4f3dafd8905d6bf755d11f9b26b43", + "sha256:a7efe807c4b83a859e2735c692b92ed7b567cfddc4163763412920041d876c2b", + "sha256:b5a9ca48055b9a20f6d1b3d68e38692e5431c86a0f99ea602e61294e891fee5b", + "sha256:c07d6e587b2f928366b1f67c09bda026a3e6fcc99e80a744dc67f8fca3895626", + "sha256:d258b0a71994f7770599835249cece1caef3c70def868c4915e6e5ca49b67d15", + "sha256:d5cd6ed995dba16fad0c521cfe31cd2d68400b53fcc2bce93326829be73ab6d1", + "sha256:d84c2aea3cf43780e9e6a19f4e4dddee9f6976519020e64e47c57e5c7a8c3dd2", + "sha256:e85895087905c65b5b594eb91f7522664c85545b147d5f4d4e7b1b07da8dcbdc", + "sha256:f81c96761fca60d64b1c9b79ec2e40cf9495a745cf570613079ef324aeb9672b" + ], + "version": "==0.4.2" + }, + "pyasn1-modules": { + "hashes": [ + "sha256:041e9fbafac548d095f5b6c3b328b80792f006196e15a232b731a83c93d59493", + "sha256:0cdca76a68dcb701fff58c397de0ef9922b472b1cb3ea9695ca19d03f1869787", + "sha256:0cea139045c38f84abaa803bcb4b5e8775ea12a42af10019d942f227acc426c3", + "sha256:0f2e50d20bc670be170966638fa0ae603f0bc9ed6ebe8e97a6d1d4cef30cc889", + "sha256:47fb6757ab78fe966e7c58b2030b546854f78416d653163f0ce9290cf2278e8b", + "sha256:598a6004ec26a8ab40a39ea955068cf2a3949ad9c0030da970f2e1ca4c9f1cc9", + "sha256:72fd8b0c11191da088147c6e4678ec53e573923ecf60b57eeac9e97433e09fc2", + "sha256:854700bbdd01394e2ada9c1bfbd0ed9f5d0c551350dbbd023e88b11d2771ae06", + "sha256:af00ea8f2022b6287dc375b2c70f31ab5af83989fc6fe9eacd4976ce26cd7ccc", + "sha256:b1f395cae2d669e0830cb023aa86f9f283b7a9aa32317d7f80d8e78aa2745812", + "sha256:c6747146e95d2b14cc2a8399b2b0bde3f93778f8f9ec704690d2b589c376c137", + "sha256:f53fe5bcebdf318f51399b250fe8325ef3a26d927f012cc0c8e0f9e9af7f9deb" + ], + "version": "==0.2.1" + }, + "pylru": { + "hashes": [ + "sha256:71376192671f0ad1690b2a7427d39a29b1df994c8469a9b46b03ed7e28c0172c" + ], + "version": "==1.0.9" + }, + "pymysql": { + "hashes": [ + "sha256:04fa19fad017fdb21394fad2878c1d6bd346959d4fbfd1b66050a09fc636a321", + "sha256:32da4a66397077d42908e449688f2ec71c2b18892a6cd04f03ab2aa828a70f40" + ], + "version": "==0.8.0" + }, + "pytest": { + "hashes": [ + "sha256:6266f87ab64692112e5477eba395cfedda53b1933ccd29478e671e73b420c19c", + "sha256:fae491d1874f199537fd5872b5e1f0e74a009b979df9d53d1553fd03da1703e1" + ], + "index": "ia", + "version": "==3.5.0" + }, + "pytest-pythonpath": { + "hashes": [ + "sha256:f3d46b0a8276e856f7dc4f70ca97b88be6fbcf52d57ce36e35057d502388265e" + ], + "index": "ia", + "version": "==0.7.2" + }, + "python-dateutil": { + "hashes": [ + "sha256:891c38b2a02f5bb1be3e4793866c8df49c7d19baabf9c1bad62547e0b4866aca", + "sha256:95511bae634d69bc7329ba55e646499a842bc4ec342ad54a8cdb65645a0aad3c" + ], + "version": "==2.6.1" + }, + "pytz": { + "hashes": [ + "sha256:07edfc3d4d2705a20a6e99d97f0c4b61c800b8232dc1c04d87e8554f130148dd", + "sha256:3a47ff71597f821cd84a162e71593004286e5be07a340fd462f0d33a760782b5", + "sha256:410bcd1d6409026fbaa65d9ed33bf6dd8b1e94a499e32168acfc7b332e4095c0", + "sha256:5bd55c744e6feaa4d599a6cbd8228b4f8f9ba96de2c38d56f08e534b3c9edf0d", + "sha256:61242a9abc626379574a166dc0e96a66cd7c3b27fc10868003fa210be4bff1c9", + "sha256:887ab5e5b32e4d0c86efddd3d055c1f363cbaa583beb8da5e22d2fa2f64d51ef", + "sha256:ba18e6a243b3625513d85239b3e49055a2f0318466e0b8a92b8fb8ca7ccdf55f", + "sha256:ed6509d9af298b7995d69a440e2822288f2eca1681b8cce37673dbb10091e5fe", + "sha256:f93ddcdd6342f94cea379c73cddb5724e0d6d0a1c91c9bdef364dc0368ba4fda" + ], + "version": "==2018.3" + }, + "pyyaml": { + "hashes": [ + "sha256:0c507b7f74b3d2dd4d1322ec8a94794927305ab4cebbe89cc47fe5e81541e6e8", + "sha256:0d8116e53b63bd0c50335d5cf151b0001bd8152e540365c515d77ed067964ffd", + "sha256:16b20e970597e051997d90dc2cddc713a2876c47e3d92d59ee198700c5427736", + "sha256:3262c96a1ca437e7e4763e2843746588a965426550f3797a79fca9c6199c431f", + "sha256:326420cbb492172dec84b0f65c80942de6cedb5233c413dd824483989c000608", + "sha256:4474f8ea030b5127225b8894d626bb66c01cda098d47a2b0d3429b6700af9fd8", + "sha256:592766c6303207a20efc445587778322d7f73b161bd994f227adaa341ba212ab", + "sha256:5ac82e411044fb129bae5cfbeb3ba626acb2af31a8d17d175004b70862a741a7", + "sha256:5f84523c076ad14ff5e6c037fe1c89a7f73a3e04cf0377cb4d017014976433f3", + "sha256:827dc04b8fa7d07c44de11fabbc888e627fa8293b695e0f99cb544fdfa1bf0d1", + "sha256:b4c423ab23291d3945ac61346feeb9a0dc4184999ede5e7c43e1ffb975130ae6", + "sha256:bc6bced57f826ca7cb5125a10b23fd0f2fff3b7c4701d64c439a300ce665fff8", + "sha256:c01b880ec30b5a6e6aa67b09a2fe3fb30473008c85cd6a67359a1b15ed6d83a4", + "sha256:ca233c64c6e40eaa6c66ef97058cdc80e8d0157a443655baa1b2966e812807ca", + "sha256:e863072cdf4c72eebf179342c94e6989c67185842d9997960b3e69290b2fa269" + ], + "version": "==3.12" + }, + "redis": { + "hashes": [ + "sha256:8a1900a9f2a0a44ecf6e8b5eb3e967a9909dfed219ad66df094f27f7d6f330fb", + "sha256:a22ca993cea2962dbb588f9f30d0015ac4afcc45bee27d3978c0dbe9e97c6c0f" + ], + "version": "==2.10.6" + }, + "requests": { + "hashes": [ + "sha256:6a1b267aa90cac58ac3a765d067950e7dbbf75b1da07e895d1f594193a40a38b", + "sha256:9c443e7324ba5b85070c4a818ade28bfabedf16ea10206da1132edaa6dda237e" + ], + "index": "ia", + "version": "==2.18.4" + }, + "requests-file": { + "hashes": [ + "sha256:75c175eed739270aec3c5279ffd74e6527dada275c5c0d76b5817e9c86bb7dea", + "sha256:8f04aa6201bacda0567e7ac7f677f1499b0fc76b22140c54bc06edf1ba92e2fa" + ], + "version": "==1.4.3" + }, + "robotexclusionrulesparser": { + "hashes": [ + "sha256:d23aa14ae8145c13c95612d696736bad52a4bd0819ce8c9437ee745098fb8388" + ], + "version": "==1.7.1" + }, + "rsa": { + "hashes": [ + "sha256:25df4e10c263fb88b5ace923dd84bf9aa7f5019687b5e55382ffcdb8bede9db5", + "sha256:43f682fea81c452c98d09fc316aae12de6d30c4b5c84226642cf8f8fd1c93abd" + ], + "version": "==3.4.2" + }, + "s3transfer": { + "hashes": [ + "sha256:90dc18e028989c609146e241ea153250be451e05ecc0c2832565231dacdf59c1", + "sha256:c7a9ec356982d5e9ab2d4b46391a7d6a950e2b04c472419f5fdec70cc0ada72f" + ], + "version": "==0.1.13" + }, + "schedule": { + "hashes": [ + "sha256:1003a07c2dce12828c25a03a611a7371cedfa956e5f1b4abc32bcc94eb5a335b", + "sha256:a24e75fc5e5acbd204049d55329e39a2a9a3479bca2e34c7fde81386c9d8d2fa" + ], + "version": "==0.5.0" + }, + "six": { + "hashes": [ + "sha256:70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9", + "sha256:832dc0e10feb1aa2c68dcc57dbb658f1c7e65b9b61af69048abc87a2db00a0eb" + ], + "version": "==1.11.0" + }, + "sqlalchemy": { + "hashes": [ + "sha256:7cb00cc9b9f92ef8b4391c8a2051f81eeafefe32d63c6b395fd51401e9a39edb" + ], + "version": "==1.2.6" + }, + "surt": { + "hashes": [ + "sha256:1e6a2f3e626b45d6c2aa278f7d5b176e8a06586870453045e6f5f2cfe5cc62a3" + ], + "version": "==0.3.0" + }, + "thriftpy": { + "hashes": [ + "sha256:309e57d97b5bfa01601393ad4f245451e989d6206a59279e56866b264a99796d", + "sha256:6baceabd40f0934186ebcfd1f559d34a9f165b65ac5d396a39ef7f61e44d9156" + ], + "version": "==0.3.9" + }, + "tldextract": { + "hashes": [ + "sha256:29797125db1f2e72ce2ee51f7a764ec8b1e6588812520795ffeae93bcd46bab4", + "sha256:84a0b275c262e34df7506e10767e357e8b5a755a3a620cdc2cfe035061f7806d" + ], + "version": "==2.2.0" + }, + "twitter": { + "hashes": [ + "sha256:52545fd3b70d3d3807d3ce62d1a256727856d784d1630d64dedcc643aaf0b908", + "sha256:acdc85e5beea752967bb64c63bde8b915c49a31a01db1b2fecccf9f2c1d5c44d" + ], + "version": "==1.18.0" + }, + "urllib3": { + "hashes": [ + "sha256:06330f386d6e4b195fbfc736b297f58c5a892e4440e54d294d7004e3a9bbea1b", + "sha256:cc44da8e1145637334317feebd728bd869a35285b93cbb4cca2577da7e62db4f" + ], + "version": "==1.22" + }, + "warctools": { + "hashes": [ + "sha256:ce0c6e274db8ac8810f7c97b3943e8e8deadbc3f5c982db77cddaae2d2ae6170" + ], + "version": "==4.10.0" + }, + "wayback": { + "hashes": [ + "sha256:4ba5d6a48de9b73171df6c2c0378954fd08a2b55b7fecb9224dd48a87281efbe" + ], + "index": "ia", + "version": "==0.2.7.4" + }, + "wayback-esp": { + "hashes": [ + "sha256:e24a692f805adc87124cedccafaa37b450ab47b5bda409beae57bcf57ef77f89" + ], + "version": "==0.1.2.1" + }, + "wayback-search-js": { + "hashes": [ + "sha256:afe198a56ca86eb0e6e78e54ad1efaa16976163f153e6e45f6c44c1d280889db" + ], + "version": "==1.4.11" + }, + "wbex-client": { + "hashes": [ + "sha256:447611c3df85175854c063ed784bb928f03262ad9a50fab2d74531c59200d94c" + ], + "version": "==0.1.5" + }, + "werkzeug": { + "hashes": [ + "sha256:c3fd7a7d41976d9f44db327260e263132466836cef6f91512889ed60ad26557c", + "sha256:d5da73735293558eb1651ee2fddc4d0dedcfa06538b8813a2e20011583c9e49b" + ], + "version": "==0.14.1" + }, + "xmltodict": { + "hashes": [ + "sha256:8f8d7d40aa28d83f4109a7e8aa86e67a4df202d9538be40c0cb1d70da527b0df", + "sha256:add07d92089ff611badec526912747cf87afd4f9447af6661aca074eeaf32615" + ], + "index": "ia", + "version": "==0.11.0" + } + }, + "develop": {} +} diff --git a/extraction/README.md b/extraction/README.md new file mode 100644 index 0000000..1da1454 --- /dev/null +++ b/extraction/README.md @@ -0,0 +1,19 @@ + + +## Development and Testing + +Requires (eg, via `apt`): + +- libjpeg-dev + +Install pipenv system-wide if you don't have it: + + # or use apt, homebrew, etc + sudo pip3 install pipenv + +Run the tests with: + + pipenv run pytest + +TODO: GROBID and HBase during development? + diff --git a/extraction/extraction.py b/extraction/extraction.py new file mode 100644 index 0000000..cdca433 --- /dev/null +++ b/extraction/extraction.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python3 + +import io +import sys +import requests +#import happybase +import mrjob +from mrjob.job import MRJob +from wayback.resource import Resource +from wayback.resource import ArcResource +from wayback.resourcestore import ResourceStore +from gwb.loader import CDXLoaderFactory + + +def process_pdf_using_grobid(content_buffer, debug_line): + """Query GrobId server & process response + """ + GROBID_SERVER="http://wbgrp-svc096.us.archive.org:8070" + content = content_buffer.read() + r = requests.post(GROBID_SERVER + "/api/processFulltextDocument", + files={'input': content}) + if r.status_code is not 200: + print("FAIL (Grobid: {}): {}".format(r.content.decode('utf8'), debug_line)) + else: + print("SUCCESS: " + debug_line) + +class Cdx_Record_Pipeline(object): + + def read_cdx_and_parse(self, parser_func, accepted_mimes = []): + """Read in CDX lines and process PDF records fetched over HTTP + """ + rstore = ResourceStore(loaderfactory=CDXLoaderFactory()) + for line in sys.stdin: + line = line.rstrip() + cdx_line = line.split() + #ignoring NLine offset + if len(cdx_line) != 12: + continue + cdx_line = cdx_line[1:] + (src_url, timestamp, mime, record_location, record_offset, record_length) = (cdx_line[2], cdx_line[1], cdx_line[3], cdx_line[-1], cdx_line[-2], cdx_line[-3]) + if '-' == record_length or not record_location.endswith('arc.gz') or mime not in accepted_mimes: + continue + orig_url = cdx_line[2] + debug_line = ' '.join(cdx_line) + try: + record_location = 'http://archive.org/download/' + record_location + record_offset = int(record_offset) + record_length = int(record_length) + resource_data = rstore.load_resource(record_location, record_offset, record_length) + parser_func(resource_data.open_raw_content(), debug_line) + except: + continue |