mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			14 lines
		
	
	
		
			404 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			14 lines
		
	
	
		
			404 B
		
	
	
	
		
			Python
		
	
	
	
	
	
import re
 | 
						|
from typing import Dict
 | 
						|
from .base import BaseParser
 | 
						|
 | 
						|
 | 
						|
class OpenGraphParser(BaseParser):
 | 
						|
    def extract_data(self) -> Dict[str, str]:
 | 
						|
        meta = self._soup.findAll('meta')
 | 
						|
        content = {}
 | 
						|
        for tag in meta:
 | 
						|
            if tag.has_attr('property') and 'og:' in tag['property']:
 | 
						|
                content[re.sub('og:', '', tag['property'])] = tag['content']
 | 
						|
        return content
 |