davidchambers / tutor

JavaScript interface for the Gatherer card database
https://gatherer.wizards.com/
Do What The F*ck You Want To Public License
149 stars 18 forks source link

What happened to image_url? #73

Closed AsaAyers closed 11 years ago

AsaAyers commented 11 years ago

It looks like #24 added image_url, but now I don't get an image_url on a tutor.card request. From the example in the README I can see that tutor.set contains image_urls on the cards, but it also doesn't seem to contain the card IDs, so I can't even make both requests and match them up.

Was this intentionally removed for some reason?

robdennis commented 11 years ago

This doesn't answer your specific question, but you can, given a URL-escaped name or gatherer id, construct a query that will give you that image.

In this forum thread I put out some sample URLs:

http://riptidelab.com/forum/threads/m14-is-on-gatherer-get-it-updated-to-ct.169/

In case it helps

On Fri, Sep 13, 2013 at 9:42 PM, Asa Ayers notifications@github.com wrote:

It looks like #24 added image_url, but now I don't get an image_url on a tutor.card request. From the example in the README I can see that tutor.set contains image_urls on the cards, but it also doesn't seem to contain the card IDs, so I can't even make both requests and match them up.

Was this intentionally removed for some reason?

Reply to this email directly or view it on GitHub: https://github.com/davidchambers/tutor/issues/73

davidchambers commented 11 years ago

Was this intentionally removed [from tutor.card responses] for some reason?

Not that I recall. The attribute should be reinstated.

robdennis commented 11 years ago

I'll take a quick peek here

robdennis commented 11 years ago

this is going to be a very brittle scrape I think

<tr>
            <td class="leftCol" align="center">
                <img src="../../Handlers/Image.ashx?multiverseid=182290&amp;type=card" id="ctl00_ctl00_ctl00_MainContent_SubContent_SubContent_cardImage" alt="Akroma, Angel of Wrath Avatar" style="border:none;" />
                <br class='clear' />
                <div class="variations">
                    &nbsp;

                </div>
                <div class="rotate">
                    <a href="javascript:void(0)" rel="lightbox" onclick="return RotateCardImage(event, this, true);">
                    </a>
                </div>
            </td>

        </tr>

edit: this is even after looking at the original thread

I'd like to suggest constructing the url like we are in the set:

          gatherer_url: "#{gatherer.origin}/Pages/Card/Details.aspx?#{param}"
          image_url: "#{gatherer.origin}/Handlers/Image.ashx?#{param}&type=card"
robdennis commented 11 years ago

so, with my current implementation for a card searched by name:

image_url: 'http://gatherer.wizards.com/Handlers/Image.ashx?type=card&#name=wild%20nacatl',
gatherer_url: 'http://gatherer.wizards.com/Pages/Card/Details.aspx?name=wild%20nacatl'

and the same card by id

image_url: 'http://gatherer.wizards.com/Handlers/Image.ashx?type=card&multiverseid=249401',
gatherer_url: 'http://gatherer.wizards.com/Pages/Card/Details.aspx?multiverseid=249401'
davidchambers commented 11 years ago

It seems reasonable for the value of image_url to depend on whether the card is requested by name or by id.