question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to get license and attribution?

See original GitHub issue

Hello, First of all thank you to Spencer and all the other contributors to this amazing library! I’m trying to get the license and attribution for the images via their commons page, what I’m doing now is making the commons URL first and then trying to find the information from that page. however, I’m not sure how to advance. as an example getting the second image’s info from “Alexander the Great” wiki article:

  wtf.fetch('Alexander the Great').then(doc => {
    let commonsPageURL = `https://commons.wikimedia.org/wiki/${doc.images()[1].file()}`
    wtf.fetch(commonsPageURL, {wiki:"commons.wikimedia"}).then(doc => {
      console.log(doc.tables()) // nothing
      console.log(doc.section("summary")) // nothing
      console.log(doc.section("licensing")) //nothing
      console.log(doc.sections()) // two sections with templates
    })
  })

Am I going about this in the wrong way?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
spencermountaincommented, Dec 22, 2021

hey @FFatur - that is a very clever solution, and a cool way to use the api. Yeah- they sure don’t make it easy. That image is using the self template, and I’ve seen a lot of images use the pd-self template. Looks like there’s also licence info in the Information template, like this one

wtf.fetch('https://commons.wikimedia.org/wiki/File:ACMA_1331_Alexander_2.JPG').then(doc => {
  let res = doc.templates().map(t => t.json())
  res = res.filter(o => o.template === 'self' || o.template === 'pd-self' || o.template === 'information')
  console.log(res)
})

oof - i’d be happy to work on improving this with you. If you got a sense for where the bulk of the licence data is, maybe we could add a Image.licence() method, or something? cheers

0reactions
spencermountaincommented, Feb 4, 2022

good question. Yeah, i was originally supporting .images(0).json(), as a supposedly-cleaner version than .images()[0] ... with null-checking. But the main library’s been turning-back from that. The plugins should follow. Like you said, it makes the typescript a mess. Feel free to change it - it just means a major version for the breaking change. cheers

Read more comments on GitHub >

github_iconTop Results From Across the Web

Get a CC License. Put it on your website. - Creative Commons
First steps · What is Creative Commons? · You don't need to register your work – just pick a license! · Make sure...
Read more >
How to Apply a Creative Commons License to Your Work
Step 4: Add the License to Your Work · Insert a copy of the appropriate CC icon from: http://creativecommons.org/about/downloads · Add some text, ......
Read more >
How to Create an Attribution - Learn To Cite - Research Guides
You can use CC-licensed materials as long as you follow the license conditions; one of which is always that you give attribution.
Read more >
Understanding copyright, licensing and attribution for photos ...
Whenever you use an image that has a Creative Commons license, you have to credit the author. This is a “moral right” even...
Read more >
How to attribute Creative Commons licensed materials
credit the creator · provide the title of the work · provide the URL where the work is hosted · indicate the type...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found