class Dependabot::Python::MetadataFinder

def source_from_homepage

def source_from_homepage
  homepage_body_local = homepage_body
  return unless homepage_body_local
  potential_source_urls = []
  homepage_body_local.scan(Source::SOURCE_REGEX) do
    potential_source_urls << Regexp.last_match.to_s
  end
  match_url = potential_source_urls.find do |url|
    repo = Source.from_url(url)&.repo
    repo&.downcase&.end_with?(normalised_dependency_name)
  end
  return match_url if match_url
  @source_from_homepage ||= T.let(
    potential_source_urls.find do |url|
      full_url = Source.from_url(url)&.url
      next unless full_url
      response = Dependabot::RegistryClient.get(url: full_url)
      next unless response.status == 200
      response.body.include?(normalised_dependency_name)
    end, T.nilable(String)
  )
end