Python 如何从<;脚本>;使用刮屑的元素

Python 如何从<;脚本>;使用刮屑的元素,python,python-3.x,scrapy,Python,Python 3.x,Scrapy,我正在尝试从magento运行的站点中抓取图像URL。中列出了产品照片URL <script type="text/x-magento-init"> { "[data-gallery-role=gallery-placeholder]": { "mage/gallery/gallery": { "mixins":["magnifier/magnify"], "magnifi

我正在尝试从magento运行的站点中抓取图像URL。中列出了产品照片URL

<script type="text/x-magento-init">
    {
        "[data-gallery-role=gallery-placeholder]": {
            "mage/gallery/gallery": {
                "mixins":["magnifier/magnify"],
                "magnifierOpts": {"fullscreenzoom":"20","top":"","left":"","width":"","height":"","eventType":"hover","enabled":false},
                "data": [{"thumb":"https:\/\/example.com.com\/media\/catalog\/product\/cache\/7298259c5e8adb86380aac\/m\/a\/product-image-1.jpg",
                "img":"https:\/\/example.com.com\/media\/catalog\/product\/cache\/d86efc38c3706eb137091cd\/m\/a\/product-image-2.jpg",
                "full":"https:\/\/example.com.com\/media\/catalog\/product\/cache\/9222bce87e716be292\/m\/a\/product-image-3.jpg",
                "caption":"Product Title","position":"1","isMain":true,"type":"image","videoUrl":null},
                {"thumb":"https:\/\/example.com.com\/media\/catalog\/product\/cache\/7298259c41aa66380aac\/m\/a\/product-image-1.jpg",
                "img":"https:\/\/example.com.com\/media\/catalog\/product\/cache\/d86efc38c3706eb13bb117091cd\/m\/a\/product-image-2.jpg","full":"https:\/\/example.com.com\/media\/catalog\/product\/cache\/9222bce87e78616be292\/m\/a\/product-image-3.jpg",
                "caption":"Product 2 Title","position":"2","isMain":false,"type":"image","videoUrl":null},
...

{
“[数据库角色=库占位符]”:{
“法师/画廊/画廊”:{
“混合”:[“放大镜/放大镜”],
“放大镜选项”:{“全屏缩放”:“20”,“顶部”:“左侧”:“宽度”:“高度”:“事件类型”:“悬停”,“启用”:false},
“数据”:[{“thumb”:“https:\/\/example.com.com\/media\/catalog\/product\/cache\/7298259c5e8adb86380aac\/m\/a\/product-image-1.jpg”,
“img”:“https:\/\/example.com.com\/media\/catalog\/product\/cache\/d86efc38c3706eb137091cd\/m\/a\/product-image-2.jpg”,
“完整”:“https:\/\/example.com.com\/media\/catalog\/product\/cache\/9222bce87e716be292\/m\/a\/product-image-3.jpg”,
“标题”:“产品标题”,“位置”:“1”,“isMain”:true,“类型”:“图像”,“视频URL”:null},
{“thumb”:“https:\/\/example.com.com\/media\/catalog\/product\/cache\/7298259c41aa66380aac\/m\/a\/product-image-1.jpg”,
“img”:“https:\/\/example.com.com\/media\/catalog\/product\/cache\/d86efc38c3706eb13bb117091cd\/m\/a\/product-image-2.jpg”,“完整”:“https:\/\/example.com.com\/media\/catalog\/product\/cache\/9222bce87e78616be292\/m\/a\/product-image-3.jpg”,
“标题”:“产品2标题”,“位置”:“2”,“isMain”:false,“类型”:“图像”,“视频URL”:null},
...
我想要的是
full
值。我不是Python大师,但我能够将脚本元素的内部放入
dict
对象中。不确定这是否是正确的步骤,以及如何从那里开始


有什么提示吗?

这是正确的继续方法。现在您可以从dict对象中获得任何您想要的内容。@CodeIt干杯。我得到了:)请在您的问题中显示dict。@BasharAbdullah您能分享一下您是如何从键入“text/x-magento-init”的脚本中解析数据的吗因为我很难做到这一点。提前谢谢。这是正确的方法。你现在可以从dict对象中获得你想要的任何东西。@CodeIt干杯。我得到了:)请在你的问题中显示dict。@BasharAbdullah你能分享一下你是如何从“text/x-magento-init”类型的脚本中解析数据的吗因为我很难做到这一点。提前谢谢。